diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-04-30 10:52:24 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-04-30 10:52:24 +0200 |
commit | 0ce2964a0f9a9041ce081a18c76d89d1671203d7 (patch) | |
tree | e4fe23b0be40b10ac29273dd5ffc1728633a126d | |
parent | 7857a5fec8339ff82de9a2510b605174ed9222c7 (diff) | |
download | stable-queue-0ce2964a0f9a9041ce081a18c76d89d1671203d7.tar.gz |
5.15-stable patches
added patches:
udp-preserve-the-connected-status-if-only-udp-cmsg.patch
-rw-r--r-- | queue-5.15/series | 1 | ||||
-rw-r--r-- | queue-5.15/udp-preserve-the-connected-status-if-only-udp-cmsg.patch | 71 |
2 files changed, 72 insertions, 0 deletions
diff --git a/queue-5.15/series b/queue-5.15/series index 22b0bc6df2..f52a023b6d 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -76,3 +76,4 @@ i2c-smbus-fix-null-function-pointer-dereference.patch fbdev-fix-incorrect-address-computation-in-deferred-io.patch hid-i2c-hid-remove-i2c_hid_read_pending-flag-to-prevent-lock-up.patch bounds-use-the-right-number-of-bits-for-power-of-two-config_nr_cpus.patch +udp-preserve-the-connected-status-if-only-udp-cmsg.patch diff --git a/queue-5.15/udp-preserve-the-connected-status-if-only-udp-cmsg.patch b/queue-5.15/udp-preserve-the-connected-status-if-only-udp-cmsg.patch new file mode 100644 index 0000000000..57217e0a5c --- /dev/null +++ b/queue-5.15/udp-preserve-the-connected-status-if-only-udp-cmsg.patch @@ -0,0 +1,71 @@ +From 680d11f6e5427b6af1321932286722d24a8b16c1 Mon Sep 17 00:00:00 2001 +From: Yick Xie <yick.xie@gmail.com> +Date: Fri, 19 Apr 2024 01:06:10 +0800 +Subject: udp: preserve the connected status if only UDP cmsg + +From: Yick Xie <yick.xie@gmail.com> + +commit 680d11f6e5427b6af1321932286722d24a8b16c1 upstream. + +If "udp_cmsg_send()" returned 0 (i.e. only UDP cmsg), +"connected" should not be set to 0. Otherwise it stops +the connected socket from using the cached route. + +Fixes: 2e8de8576343 ("udp: add gso segment cmsg") +Signed-off-by: Yick Xie <yick.xie@gmail.com> +Cc: stable@vger.kernel.org +Reviewed-by: Willem de Bruijn <willemb@google.com> +Link: https://lore.kernel.org/r/20240418170610.867084-1-yick.xie@gmail.com +Signed-off-by: Jakub Kicinski <kuba@kernel.org> +Signed-off-by: Yick Xie <yick.xie@gmail.com> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + net/ipv4/udp.c | 5 +++-- + net/ipv6/udp.c | 5 +++-- + 2 files changed, 6 insertions(+), 4 deletions(-) + +--- a/net/ipv4/udp.c ++++ b/net/ipv4/udp.c +@@ -1139,16 +1139,17 @@ int udp_sendmsg(struct sock *sk, struct + + if (msg->msg_controllen) { + err = udp_cmsg_send(sk, msg, &ipc.gso_size); +- if (err > 0) ++ if (err > 0) { + err = ip_cmsg_send(sk, msg, &ipc, + sk->sk_family == AF_INET6); ++ connected = 0; ++ } + if (unlikely(err < 0)) { + kfree(ipc.opt); + return err; + } + if (ipc.opt) + free = 1; +- connected = 0; + } + if (!ipc.opt) { + struct ip_options_rcu *inet_opt; +--- a/net/ipv6/udp.c ++++ b/net/ipv6/udp.c +@@ -1479,9 +1479,11 @@ do_udp_sendmsg: + ipc6.opt = opt; + + err = udp_cmsg_send(sk, msg, &ipc6.gso_size); +- if (err > 0) ++ if (err > 0) { + err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, + &ipc6); ++ connected = false; ++ } + if (err < 0) { + fl6_sock_release(flowlabel); + return err; +@@ -1493,7 +1495,6 @@ do_udp_sendmsg: + } + if (!(opt->opt_nflen|opt->opt_flen)) + opt = NULL; +- connected = false; + } + if (!opt) { + opt = txopt_get(np); |