FAILED: patch "[PATCH] udp: preserve the connected status if only UDP cmsg" failed to apply to 5.4-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y
git checkout FETCH_HEAD
git cherry-pick -x 680d11f6e5427b6af1321932286722d24a8b16c1
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024042920-overcoat-cannot-efc1@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^..
Possible dependencies:
680d11f6e542 ("udp: preserve the connected status if only UDP cmsg") 5298953e742d ("udp6: don't make extra copies of iflow")42dcfd850e51 ("udp6: allow SO_MARK ctrl msg to affect routing") 3df98d79215a ("lsm,selinux: pass flowi_common instead of flowi to the LSM hooks") e94ee171349d ("xfrm: Use correct address family in xfrm_state_find") 5eff06902394 ("ipv4: fill fl4_icmp_{type,code} in ping_v4_sendmsg") 6abde0b24122 ("crypto/chtls: IPv6 support for inline TLS") ed52f2c608c9 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 680d11f6e5427b6af1321932286722d24a8b16c1 Mon Sep 17 00:00:00 2001
From: Yick Xie <[email protected]>
Date: Fri, 19 Apr 2024 01:06:10 +0800
Subject: [PATCH] udp: preserve the connected status if only UDP cmsg
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.
net/ipv4/udp.c +3 -2
@@ -1123,16 +1123,17 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)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;
net/ipv6/udp.c +3 -2
@@ -1474,9 +1474,11 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) 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;
@@ -1488,7 +1490,6 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) }if (!(opt->opt_nflen|opt->opt_flen)) opt =NULL ; - connected = false; }if (!opt) { opt =txopt_get (np);
PATCH 1/1 udp: preserve the connected status if only UDP cmsg
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.
--- net/ipv4/udp.c | 5 +++-- net/ipv6/udp.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
net/ipv4/udp.c +3 -2
@@ -1054,16 +1054,17 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)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;
net/ipv6/udp.c +3 -2
@@ -1387,9 +1387,11 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) 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;
@@ -1401,7 +1403,6 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) }if (!(opt->opt_nflen|opt->opt_flen)) opt =NULL ; - connected = false; }if (!opt) { opt =txopt_get (np);
Signature · 1 line
2.34.1