]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.19
authorSasha Levin <sashal@kernel.org>
Sat, 31 Aug 2024 23:13:53 +0000 (19:13 -0400)
committerSasha Levin <sashal@kernel.org>
Sat, 31 Aug 2024 23:13:53 +0000 (19:13 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.19/gtp-fix-a-potential-null-pointer-dereference.patch [new file with mode: 0644]
queue-4.19/net-busy-poll-use-ktime_get_ns-instead-of-local_cloc.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/gtp-fix-a-potential-null-pointer-dereference.patch b/queue-4.19/gtp-fix-a-potential-null-pointer-dereference.patch
new file mode 100644 (file)
index 0000000..fb2013b
--- /dev/null
@@ -0,0 +1,47 @@
+From a556b3e3abb0461855f88428bb0e7de0f25f7593 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 25 Aug 2024 12:16:38 -0700
+Subject: gtp: fix a potential NULL pointer dereference
+
+From: Cong Wang <cong.wang@bytedance.com>
+
+[ Upstream commit defd8b3c37b0f9cb3e0f60f47d3d78d459d57fda ]
+
+When sockfd_lookup() fails, gtp_encap_enable_socket() returns a
+NULL pointer, but its callers only check for error pointers thus miss
+the NULL pointer case.
+
+Fix it by returning an error pointer with the error code carried from
+sockfd_lookup().
+
+(I found this bug during code inspection.)
+
+Fixes: 1e3a3abd8b28 ("gtp: make GTP sockets in gtp_newlink optional")
+Cc: Andreas Schultz <aschultz@tpip.net>
+Cc: Harald Welte <laforge@gnumonks.org>
+Signed-off-by: Cong Wang <cong.wang@bytedance.com>
+Reviewed-by: Simon Horman <horms@kernel.org>
+Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
+Link: https://patch.msgid.link/20240825191638.146748-1-xiyou.wangcong@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/gtp.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
+index cc80bd98e172d..733cafb0888f6 100644
+--- a/drivers/net/gtp.c
++++ b/drivers/net/gtp.c
+@@ -812,7 +812,7 @@ static struct sock *gtp_encap_enable_socket(int fd, int type,
+       sock = sockfd_lookup(fd, &err);
+       if (!sock) {
+               pr_debug("gtp socket fd=%d not found\n", fd);
+-              return NULL;
++              return ERR_PTR(err);
+       }
+       sk = sock->sk;
+-- 
+2.43.0
+
diff --git a/queue-4.19/net-busy-poll-use-ktime_get_ns-instead-of-local_cloc.patch b/queue-4.19/net-busy-poll-use-ktime_get_ns-instead-of-local_cloc.patch
new file mode 100644 (file)
index 0000000..acd130a
--- /dev/null
@@ -0,0 +1,48 @@
+From ad0c4aaa1be78795cdf1914532e0664f425757e0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 27 Aug 2024 11:49:16 +0000
+Subject: net: busy-poll: use ktime_get_ns() instead of local_clock()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit 0870b0d8b393dde53106678a1e2cec9dfa52f9b7 ]
+
+Typically, busy-polling durations are below 100 usec.
+
+When/if the busy-poller thread migrates to another cpu,
+local_clock() can be off by +/-2msec or more for small
+values of HZ, depending on the platform.
+
+Use ktimer_get_ns() to ensure deterministic behavior,
+which is the whole point of busy-polling.
+
+Fixes: 060212928670 ("net: add low latency socket poll")
+Fixes: 9a3c71aa8024 ("net: convert low latency sockets to sched_clock()")
+Fixes: 37089834528b ("sched, net: Fixup busy_loop_us_clock()")
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Cc: Mina Almasry <almasrymina@google.com>
+Cc: Willem de Bruijn <willemb@google.com>
+Reviewed-by: Joe Damato <jdamato@fastly.com>
+Link: https://patch.msgid.link/20240827114916.223377-1-edumazet@google.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/net/busy_poll.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h
+index 8f42f6f3af86f..c45253ee08c9f 100644
+--- a/include/net/busy_poll.h
++++ b/include/net/busy_poll.h
+@@ -73,7 +73,7 @@ static inline bool sk_can_busy_loop(struct sock *sk)
+ static inline unsigned long busy_loop_current_time(void)
+ {
+ #ifdef CONFIG_NET_RX_BUSY_POLL
+-      return (unsigned long)(local_clock() >> 10);
++      return (unsigned long)(ktime_get_ns() >> 10);
+ #else
+       return 0;
+ #endif
+-- 
+2.43.0
+
index 9d8bee9995e4910ce27dbe1e0091ffe0215bdfc6..2f07ab5284f5a9839b7dfa447801ee189b871a40 100644 (file)
@@ -85,3 +85,5 @@ net-rds-fix-possible-deadlock-in-rds_message_put.patch
 ida-fix-crash-in-ida_free-when-the-bitmap-is-empty.patch
 net-prevent-mss-overflow-in-skb_segment.patch
 soundwire-stream-fix-programming-slave-ports-for-non-continous-port-maps.patch
+gtp-fix-a-potential-null-pointer-dereference.patch
+net-busy-poll-use-ktime_get_ns-instead-of-local_cloc.patch