From: Sasha Levin Date: Sat, 31 Aug 2024 23:13:53 +0000 (-0400) Subject: Fixes for 4.19 X-Git-Tag: v4.19.321~30 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8b1937077fc6481ceb13622e1d8c2999c4ea0cd3;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- 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 index 00000000000..fb2013be5f6 --- /dev/null +++ b/queue-4.19/gtp-fix-a-potential-null-pointer-dereference.patch @@ -0,0 +1,47 @@ +From a556b3e3abb0461855f88428bb0e7de0f25f7593 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 25 Aug 2024 12:16:38 -0700 +Subject: gtp: fix a potential NULL pointer dereference + +From: Cong Wang + +[ 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 +Cc: Harald Welte +Signed-off-by: Cong Wang +Reviewed-by: Simon Horman +Reviewed-by: Pablo Neira Ayuso +Link: https://patch.msgid.link/20240825191638.146748-1-xiyou.wangcong@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + 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 index 00000000000..acd130aa57b --- /dev/null +++ b/queue-4.19/net-busy-poll-use-ktime_get_ns-instead-of-local_cloc.patch @@ -0,0 +1,48 @@ +From ad0c4aaa1be78795cdf1914532e0664f425757e0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Aug 2024 11:49:16 +0000 +Subject: net: busy-poll: use ktime_get_ns() instead of local_clock() + +From: Eric Dumazet + +[ 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 +Cc: Mina Almasry +Cc: Willem de Bruijn +Reviewed-by: Joe Damato +Link: https://patch.msgid.link/20240827114916.223377-1-edumazet@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + 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 + diff --git a/queue-4.19/series b/queue-4.19/series index 9d8bee9995e..2f07ab5284f 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -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