From: Sasha Levin Date: Mon, 20 Sep 2021 12:14:39 +0000 (-0400) Subject: Drop revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch X-Git-Tag: v4.4.284~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f24ebe6ea95a79f55745ad62a36c2ec7fec08bde;p=thirdparty%2Fkernel%2Fstable-queue.git Drop revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch Signed-off-by: Sasha Levin --- diff --git a/queue-4.14/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch b/queue-4.14/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch deleted file mode 100644 index 8b4133b1a64..00000000000 --- a/queue-4.14/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch +++ /dev/null @@ -1,80 +0,0 @@ -From d7807a9adf4856171f8441f13078c33941df48ab Mon Sep 17 00:00:00 2001 -From: Yajun Deng -Date: Mon, 13 Sep 2021 12:04:42 +0800 -Subject: Revert "ipv4: fix memory leaks in ip_cmsg_send() callers" - -From: Yajun Deng - -commit d7807a9adf4856171f8441f13078c33941df48ab upstream. - -This reverts commit 919483096bfe75dda338e98d56da91a263746a0a. - -There is only when ip_options_get() return zero need to free. -It already called kfree() when return error. - -Fixes: 919483096bfe ("ipv4: fix memory leaks in ip_cmsg_send() callers") -Signed-off-by: Yajun Deng -Signed-off-by: David S. Miller -Signed-off-by: Greg Kroah-Hartman ---- - net/ipv4/ip_sockglue.c | 2 +- - net/ipv4/ping.c | 5 ++--- - net/ipv4/raw.c | 5 ++--- - net/ipv4/udp.c | 4 +--- - 4 files changed, 6 insertions(+), 10 deletions(-) - ---- a/net/ipv4/ip_sockglue.c -+++ b/net/ipv4/ip_sockglue.c -@@ -277,7 +277,7 @@ int ip_cmsg_send(struct sock *sk, struct - case IP_RETOPTS: - err = cmsg->cmsg_len - sizeof(struct cmsghdr); - -- /* Our caller is responsible for freeing ipc->opt */ -+ /* Our caller is responsible for freeing ipc->opt when err = 0 */ - err = ip_options_get(net, &ipc->opt, CMSG_DATA(cmsg), - err < 40 ? err : 40); - if (err) ---- a/net/ipv4/ping.c -+++ b/net/ipv4/ping.c -@@ -749,10 +749,9 @@ static int ping_v4_sendmsg(struct sock * - - if (msg->msg_controllen) { - err = ip_cmsg_send(sk, msg, &ipc, false); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - return err; -- } -+ - if (ipc.opt) - free = 1; - } ---- a/net/ipv4/raw.c -+++ b/net/ipv4/raw.c -@@ -571,10 +571,9 @@ static int raw_sendmsg(struct sock *sk, - - if (msg->msg_controllen) { - err = ip_cmsg_send(sk, msg, &ipc, false); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - goto out; -- } -+ - if (ipc.opt) - free = 1; - } ---- a/net/ipv4/udp.c -+++ b/net/ipv4/udp.c -@@ -955,10 +955,8 @@ int udp_sendmsg(struct sock *sk, struct - - if (msg->msg_controllen) { - err = ip_cmsg_send(sk, msg, &ipc, sk->sk_family == AF_INET6); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - return err; -- } - if (ipc.opt) - free = 1; - connected = 0; diff --git a/queue-4.14/series b/queue-4.14/series index 329b500274a..bb226e77cd5 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -200,6 +200,5 @@ r6040-restore-mdio-clock-frequency-after-mac-reset.patch tipc-increase-timeout-in-tipc_sk_enqueue.patch events-reuse-value-read-using-read_once-instead-of-re-reading-it.patch net-af_unix-fix-a-data-race-in-unix_dgram_poll.patch -revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch tcp-fix-tp-undo_retrans-accounting-in-tcp_sacktag_one.patch ibmvnic-check-failover_pending-in-login-response.patch diff --git a/queue-4.19/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch b/queue-4.19/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch deleted file mode 100644 index 68b5e6a3c2f..00000000000 --- a/queue-4.19/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch +++ /dev/null @@ -1,81 +0,0 @@ -From d7807a9adf4856171f8441f13078c33941df48ab Mon Sep 17 00:00:00 2001 -From: Yajun Deng -Date: Mon, 13 Sep 2021 12:04:42 +0800 -Subject: Revert "ipv4: fix memory leaks in ip_cmsg_send() callers" - -From: Yajun Deng - -commit d7807a9adf4856171f8441f13078c33941df48ab upstream. - -This reverts commit 919483096bfe75dda338e98d56da91a263746a0a. - -There is only when ip_options_get() return zero need to free. -It already called kfree() when return error. - -Fixes: 919483096bfe ("ipv4: fix memory leaks in ip_cmsg_send() callers") -Signed-off-by: Yajun Deng -Signed-off-by: David S. Miller -Signed-off-by: Greg Kroah-Hartman ---- - net/ipv4/ip_sockglue.c | 2 +- - net/ipv4/ping.c | 5 ++--- - net/ipv4/raw.c | 5 ++--- - net/ipv4/udp.c | 5 ++--- - 4 files changed, 7 insertions(+), 10 deletions(-) - ---- a/net/ipv4/ip_sockglue.c -+++ b/net/ipv4/ip_sockglue.c -@@ -279,7 +279,7 @@ int ip_cmsg_send(struct sock *sk, struct - case IP_RETOPTS: - err = cmsg->cmsg_len - sizeof(struct cmsghdr); - -- /* Our caller is responsible for freeing ipc->opt */ -+ /* Our caller is responsible for freeing ipc->opt when err = 0 */ - err = ip_options_get(net, &ipc->opt, CMSG_DATA(cmsg), - err < 40 ? err : 40); - if (err) ---- a/net/ipv4/ping.c -+++ b/net/ipv4/ping.c -@@ -741,10 +741,9 @@ static int ping_v4_sendmsg(struct sock * - - if (msg->msg_controllen) { - err = ip_cmsg_send(sk, msg, &ipc, false); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - return err; -- } -+ - if (ipc.opt) - free = 1; - } ---- a/net/ipv4/raw.c -+++ b/net/ipv4/raw.c -@@ -566,10 +566,9 @@ static int raw_sendmsg(struct sock *sk, - - if (msg->msg_controllen) { - err = ip_cmsg_send(sk, msg, &ipc, false); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - goto out; -- } -+ - if (ipc.opt) - free = 1; - } ---- a/net/ipv4/udp.c -+++ b/net/ipv4/udp.c -@@ -1004,10 +1004,9 @@ int udp_sendmsg(struct sock *sk, struct - if (err > 0) - err = ip_cmsg_send(sk, msg, &ipc, - sk->sk_family == AF_INET6); -- if (unlikely(err < 0)) { -- kfree(ipc.opt); -+ if (unlikely(err < 0)) - return err; -- } -+ - if (ipc.opt) - free = 1; - connected = 0; diff --git a/queue-4.19/series b/queue-4.19/series index af6a7e3e956..b4ad1c516c6 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -266,7 +266,6 @@ net-mlx5-fix-potential-sleeping-in-atomic-context.patch events-reuse-value-read-using-read_once-instead-of-re-reading-it.patch net-af_unix-fix-a-data-race-in-unix_dgram_poll.patch net-dsa-destroy-the-phylink-instance-on-any-error-in-dsa_slave_phy_setup.patch -revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch tcp-fix-tp-undo_retrans-accounting-in-tcp_sacktag_one.patch qed-handle-management-fw-error.patch ibmvnic-check-failover_pending-in-login-response.patch diff --git a/queue-4.4/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch b/queue-4.4/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch deleted file mode 100644 index df7b1067c48..00000000000 --- a/queue-4.4/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch +++ /dev/null @@ -1,78 +0,0 @@ -From d7807a9adf4856171f8441f13078c33941df48ab Mon Sep 17 00:00:00 2001 -From: Yajun Deng -Date: Mon, 13 Sep 2021 12:04:42 +0800 -Subject: Revert "ipv4: fix memory leaks in ip_cmsg_send() callers" - -From: Yajun Deng - -commit d7807a9adf4856171f8441f13078c33941df48ab upstream. - -This reverts commit 919483096bfe75dda338e98d56da91a263746a0a. - -There is only when ip_options_get() return zero need to free. -It already called kfree() when return error. - -Fixes: 919483096bfe ("ipv4: fix memory leaks in ip_cmsg_send() callers") -Signed-off-by: Yajun Deng -Signed-off-by: David S. Miller -Signed-off-by: Greg Kroah-Hartman ---- - net/ipv4/ip_sockglue.c | 2 +- - net/ipv4/ping.c | 4 +--- - net/ipv4/raw.c | 4 +--- - net/ipv4/udp.c | 4 +--- - 4 files changed, 4 insertions(+), 10 deletions(-) - ---- a/net/ipv4/ip_sockglue.c -+++ b/net/ipv4/ip_sockglue.c -@@ -253,7 +253,7 @@ int ip_cmsg_send(struct net *net, struct - case IP_RETOPTS: - err = cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr)); - -- /* Our caller is responsible for freeing ipc->opt */ -+ /* Our caller is responsible for freeing ipc->opt when err = 0 */ - err = ip_options_get(net, &ipc->opt, CMSG_DATA(cmsg), - err < 40 ? err : 40); - if (err) ---- a/net/ipv4/ping.c -+++ b/net/ipv4/ping.c -@@ -753,10 +753,8 @@ static int ping_v4_sendmsg(struct sock * - - if (msg->msg_controllen) { - err = ip_cmsg_send(sock_net(sk), msg, &ipc, false); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - return err; -- } - if (ipc.opt) - free = 1; - } ---- a/net/ipv4/raw.c -+++ b/net/ipv4/raw.c -@@ -557,10 +557,8 @@ static int raw_sendmsg(struct sock *sk, - - if (msg->msg_controllen) { - err = ip_cmsg_send(net, msg, &ipc, false); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - goto out; -- } - if (ipc.opt) - free = 1; - } ---- a/net/ipv4/udp.c -+++ b/net/ipv4/udp.c -@@ -966,10 +966,8 @@ int udp_sendmsg(struct sock *sk, struct - if (msg->msg_controllen) { - err = ip_cmsg_send(sock_net(sk), msg, &ipc, - sk->sk_family == AF_INET6); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - return err; -- } - if (ipc.opt) - free = 1; - connected = 0; diff --git a/queue-4.4/series b/queue-4.4/series index dc8d65f5f7d..92369c4ce9b 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -123,5 +123,4 @@ net-l2tp-fix-reference-count-leak-in-l2tp_udp_recv_core.patch r6040-restore-mdio-clock-frequency-after-mac-reset.patch tipc-increase-timeout-in-tipc_sk_enqueue.patch net-af_unix-fix-a-data-race-in-unix_dgram_poll.patch -revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch x86-mm-fix-kern_addr_valid-to-cope-with-existing-but-not-present-entries.patch diff --git a/queue-4.9/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch b/queue-4.9/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch deleted file mode 100644 index 60dbab6dda4..00000000000 --- a/queue-4.9/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch +++ /dev/null @@ -1,80 +0,0 @@ -From d7807a9adf4856171f8441f13078c33941df48ab Mon Sep 17 00:00:00 2001 -From: Yajun Deng -Date: Mon, 13 Sep 2021 12:04:42 +0800 -Subject: Revert "ipv4: fix memory leaks in ip_cmsg_send() callers" - -From: Yajun Deng - -commit d7807a9adf4856171f8441f13078c33941df48ab upstream. - -This reverts commit 919483096bfe75dda338e98d56da91a263746a0a. - -There is only when ip_options_get() return zero need to free. -It already called kfree() when return error. - -Fixes: 919483096bfe ("ipv4: fix memory leaks in ip_cmsg_send() callers") -Signed-off-by: Yajun Deng -Signed-off-by: David S. Miller -Signed-off-by: Greg Kroah-Hartman ---- - net/ipv4/ip_sockglue.c | 2 +- - net/ipv4/ping.c | 5 ++--- - net/ipv4/raw.c | 5 ++--- - net/ipv4/udp.c | 4 +--- - 4 files changed, 6 insertions(+), 10 deletions(-) - ---- a/net/ipv4/ip_sockglue.c -+++ b/net/ipv4/ip_sockglue.c -@@ -261,7 +261,7 @@ int ip_cmsg_send(struct sock *sk, struct - case IP_RETOPTS: - err = cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr)); - -- /* Our caller is responsible for freeing ipc->opt */ -+ /* Our caller is responsible for freeing ipc->opt when err = 0 */ - err = ip_options_get(net, &ipc->opt, CMSG_DATA(cmsg), - err < 40 ? err : 40); - if (err) ---- a/net/ipv4/ping.c -+++ b/net/ipv4/ping.c -@@ -749,10 +749,9 @@ static int ping_v4_sendmsg(struct sock * - - if (msg->msg_controllen) { - err = ip_cmsg_send(sk, msg, &ipc, false); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - return err; -- } -+ - if (ipc.opt) - free = 1; - } ---- a/net/ipv4/raw.c -+++ b/net/ipv4/raw.c -@@ -560,10 +560,9 @@ static int raw_sendmsg(struct sock *sk, - - if (msg->msg_controllen) { - err = ip_cmsg_send(sk, msg, &ipc, false); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - goto out; -- } -+ - if (ipc.opt) - free = 1; - } ---- a/net/ipv4/udp.c -+++ b/net/ipv4/udp.c -@@ -959,10 +959,8 @@ int udp_sendmsg(struct sock *sk, struct - - if (msg->msg_controllen) { - err = ip_cmsg_send(sk, msg, &ipc, sk->sk_family == AF_INET6); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - return err; -- } - if (ipc.opt) - free = 1; - connected = 0; diff --git a/queue-4.9/series b/queue-4.9/series index e3c24223dd6..1536f1d155d 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -160,7 +160,6 @@ r6040-restore-mdio-clock-frequency-after-mac-reset.patch tipc-increase-timeout-in-tipc_sk_enqueue.patch events-reuse-value-read-using-read_once-instead-of-re-reading-it.patch net-af_unix-fix-a-data-race-in-unix_dgram_poll.patch -revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch tcp-fix-tp-undo_retrans-accounting-in-tcp_sacktag_one.patch ibmvnic-check-failover_pending-in-login-response.patch x86-mm-fix-kern_addr_valid-to-cope-with-existing-but-not-present-entries.patch diff --git a/queue-5.10/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch b/queue-5.10/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch deleted file mode 100644 index 1e88c0be8ff..00000000000 --- a/queue-5.10/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch +++ /dev/null @@ -1,81 +0,0 @@ -From d7807a9adf4856171f8441f13078c33941df48ab Mon Sep 17 00:00:00 2001 -From: Yajun Deng -Date: Mon, 13 Sep 2021 12:04:42 +0800 -Subject: Revert "ipv4: fix memory leaks in ip_cmsg_send() callers" - -From: Yajun Deng - -commit d7807a9adf4856171f8441f13078c33941df48ab upstream. - -This reverts commit 919483096bfe75dda338e98d56da91a263746a0a. - -There is only when ip_options_get() return zero need to free. -It already called kfree() when return error. - -Fixes: 919483096bfe ("ipv4: fix memory leaks in ip_cmsg_send() callers") -Signed-off-by: Yajun Deng -Signed-off-by: David S. Miller -Signed-off-by: Greg Kroah-Hartman ---- - net/ipv4/ip_sockglue.c | 2 +- - net/ipv4/ping.c | 5 ++--- - net/ipv4/raw.c | 5 ++--- - net/ipv4/udp.c | 5 ++--- - 4 files changed, 7 insertions(+), 10 deletions(-) - ---- a/net/ipv4/ip_sockglue.c -+++ b/net/ipv4/ip_sockglue.c -@@ -279,7 +279,7 @@ int ip_cmsg_send(struct sock *sk, struct - case IP_RETOPTS: - err = cmsg->cmsg_len - sizeof(struct cmsghdr); - -- /* Our caller is responsible for freeing ipc->opt */ -+ /* Our caller is responsible for freeing ipc->opt when err = 0 */ - err = ip_options_get(net, &ipc->opt, - KERNEL_SOCKPTR(CMSG_DATA(cmsg)), - err < 40 ? err : 40); ---- a/net/ipv4/ping.c -+++ b/net/ipv4/ping.c -@@ -725,10 +725,9 @@ static int ping_v4_sendmsg(struct sock * - - if (msg->msg_controllen) { - err = ip_cmsg_send(sk, msg, &ipc, false); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - return err; -- } -+ - if (ipc.opt) - free = 1; - } ---- a/net/ipv4/raw.c -+++ b/net/ipv4/raw.c -@@ -562,10 +562,9 @@ static int raw_sendmsg(struct sock *sk, - - if (msg->msg_controllen) { - err = ip_cmsg_send(sk, msg, &ipc, false); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - goto out; -- } -+ - if (ipc.opt) - free = 1; - } ---- a/net/ipv4/udp.c -+++ b/net/ipv4/udp.c -@@ -1104,10 +1104,9 @@ int udp_sendmsg(struct sock *sk, struct - if (err > 0) - err = ip_cmsg_send(sk, msg, &ipc, - sk->sk_family == AF_INET6); -- if (unlikely(err < 0)) { -- kfree(ipc.opt); -+ if (unlikely(err < 0)) - return err; -- } -+ - if (ipc.opt) - free = 1; - connected = 0; diff --git a/queue-5.10/series b/queue-5.10/series index c39d304febd..32da2cedcb6 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -38,7 +38,6 @@ gen_compile_commands-fix-missing-sys-package.patch vhost_net-fix-oob-on-sendmsg-failure.patch net-af_unix-fix-a-data-race-in-unix_dgram_poll.patch net-dsa-destroy-the-phylink-instance-on-any-error-in-dsa_slave_phy_setup.patch -revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch x86-uaccess-fix-32-bit-__get_user_asm_u64-when-cc_has_asm_goto_output-y.patch tcp-fix-tp-undo_retrans-accounting-in-tcp_sacktag_one.patch selftest-net-fix-typo-in-altname-test.patch diff --git a/queue-5.14/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch b/queue-5.14/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch deleted file mode 100644 index 3e6d11245b8..00000000000 --- a/queue-5.14/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch +++ /dev/null @@ -1,81 +0,0 @@ -From d7807a9adf4856171f8441f13078c33941df48ab Mon Sep 17 00:00:00 2001 -From: Yajun Deng -Date: Mon, 13 Sep 2021 12:04:42 +0800 -Subject: Revert "ipv4: fix memory leaks in ip_cmsg_send() callers" - -From: Yajun Deng - -commit d7807a9adf4856171f8441f13078c33941df48ab upstream. - -This reverts commit 919483096bfe75dda338e98d56da91a263746a0a. - -There is only when ip_options_get() return zero need to free. -It already called kfree() when return error. - -Fixes: 919483096bfe ("ipv4: fix memory leaks in ip_cmsg_send() callers") -Signed-off-by: Yajun Deng -Signed-off-by: David S. Miller -Signed-off-by: Greg Kroah-Hartman ---- - net/ipv4/ip_sockglue.c | 2 +- - net/ipv4/ping.c | 5 ++--- - net/ipv4/raw.c | 5 ++--- - net/ipv4/udp.c | 5 ++--- - 4 files changed, 7 insertions(+), 10 deletions(-) - ---- a/net/ipv4/ip_sockglue.c -+++ b/net/ipv4/ip_sockglue.c -@@ -279,7 +279,7 @@ int ip_cmsg_send(struct sock *sk, struct - case IP_RETOPTS: - err = cmsg->cmsg_len - sizeof(struct cmsghdr); - -- /* Our caller is responsible for freeing ipc->opt */ -+ /* Our caller is responsible for freeing ipc->opt when err = 0 */ - err = ip_options_get(net, &ipc->opt, - KERNEL_SOCKPTR(CMSG_DATA(cmsg)), - err < 40 ? err : 40); ---- a/net/ipv4/ping.c -+++ b/net/ipv4/ping.c -@@ -727,10 +727,9 @@ static int ping_v4_sendmsg(struct sock * - - if (msg->msg_controllen) { - err = ip_cmsg_send(sk, msg, &ipc, false); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - return err; -- } -+ - if (ipc.opt) - free = 1; - } ---- a/net/ipv4/raw.c -+++ b/net/ipv4/raw.c -@@ -562,10 +562,9 @@ static int raw_sendmsg(struct sock *sk, - - if (msg->msg_controllen) { - err = ip_cmsg_send(sk, msg, &ipc, false); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - goto out; -- } -+ - if (ipc.opt) - free = 1; - } ---- a/net/ipv4/udp.c -+++ b/net/ipv4/udp.c -@@ -1122,10 +1122,9 @@ int udp_sendmsg(struct sock *sk, struct - if (err > 0) - err = ip_cmsg_send(sk, msg, &ipc, - sk->sk_family == AF_INET6); -- if (unlikely(err < 0)) { -- kfree(ipc.opt); -+ if (unlikely(err < 0)) - return err; -- } -+ - if (ipc.opt) - free = 1; - connected = 0; diff --git a/queue-5.14/series b/queue-5.14/series index 367fc95f663..5a0266d88fe 100644 --- a/queue-5.14/series +++ b/queue-5.14/series @@ -60,7 +60,6 @@ gen_compile_commands-fix-missing-sys-package.patch vhost_net-fix-oob-on-sendmsg-failure.patch net-af_unix-fix-a-data-race-in-unix_dgram_poll.patch net-dsa-destroy-the-phylink-instance-on-any-error-in-dsa_slave_phy_setup.patch -revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch x86-uaccess-fix-32-bit-__get_user_asm_u64-when-cc_has_asm_goto_output-y.patch bpf-cgroups-fix-cgroup-v2-fallback-on-v1-v2-mixed-mode.patch tcp-fix-tp-undo_retrans-accounting-in-tcp_sacktag_one.patch diff --git a/queue-5.4/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch b/queue-5.4/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch deleted file mode 100644 index a504e30833d..00000000000 --- a/queue-5.4/revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch +++ /dev/null @@ -1,81 +0,0 @@ -From d7807a9adf4856171f8441f13078c33941df48ab Mon Sep 17 00:00:00 2001 -From: Yajun Deng -Date: Mon, 13 Sep 2021 12:04:42 +0800 -Subject: Revert "ipv4: fix memory leaks in ip_cmsg_send() callers" - -From: Yajun Deng - -commit d7807a9adf4856171f8441f13078c33941df48ab upstream. - -This reverts commit 919483096bfe75dda338e98d56da91a263746a0a. - -There is only when ip_options_get() return zero need to free. -It already called kfree() when return error. - -Fixes: 919483096bfe ("ipv4: fix memory leaks in ip_cmsg_send() callers") -Signed-off-by: Yajun Deng -Signed-off-by: David S. Miller -Signed-off-by: Greg Kroah-Hartman ---- - net/ipv4/ip_sockglue.c | 2 +- - net/ipv4/ping.c | 5 ++--- - net/ipv4/raw.c | 5 ++--- - net/ipv4/udp.c | 5 ++--- - 4 files changed, 7 insertions(+), 10 deletions(-) - ---- a/net/ipv4/ip_sockglue.c -+++ b/net/ipv4/ip_sockglue.c -@@ -279,7 +279,7 @@ int ip_cmsg_send(struct sock *sk, struct - case IP_RETOPTS: - err = cmsg->cmsg_len - sizeof(struct cmsghdr); - -- /* Our caller is responsible for freeing ipc->opt */ -+ /* Our caller is responsible for freeing ipc->opt when err = 0 */ - err = ip_options_get(net, &ipc->opt, CMSG_DATA(cmsg), - err < 40 ? err : 40); - if (err) ---- a/net/ipv4/ping.c -+++ b/net/ipv4/ping.c -@@ -736,10 +736,9 @@ static int ping_v4_sendmsg(struct sock * - - if (msg->msg_controllen) { - err = ip_cmsg_send(sk, msg, &ipc, false); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - return err; -- } -+ - if (ipc.opt) - free = 1; - } ---- a/net/ipv4/raw.c -+++ b/net/ipv4/raw.c -@@ -561,10 +561,9 @@ static int raw_sendmsg(struct sock *sk, - - if (msg->msg_controllen) { - err = ip_cmsg_send(sk, msg, &ipc, false); -- if (unlikely(err)) { -- kfree(ipc.opt); -+ if (unlikely(err)) - goto out; -- } -+ - if (ipc.opt) - free = 1; - } ---- a/net/ipv4/udp.c -+++ b/net/ipv4/udp.c -@@ -1050,10 +1050,9 @@ int udp_sendmsg(struct sock *sk, struct - if (err > 0) - err = ip_cmsg_send(sk, msg, &ipc, - sk->sk_family == AF_INET6); -- if (unlikely(err < 0)) { -- kfree(ipc.opt); -+ if (unlikely(err < 0)) - return err; -- } -+ - if (ipc.opt) - free = 1; - connected = 0; diff --git a/queue-5.4/series b/queue-5.4/series index 09d78d28ce6..1ca1f077888 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -220,7 +220,6 @@ events-reuse-value-read-using-read_once-instead-of-re-reading-it.patch vhost_net-fix-oob-on-sendmsg-failure.patch net-af_unix-fix-a-data-race-in-unix_dgram_poll.patch net-dsa-destroy-the-phylink-instance-on-any-error-in-dsa_slave_phy_setup.patch -revert-ipv4-fix-memory-leaks-in-ip_cmsg_send-callers.patch tcp-fix-tp-undo_retrans-accounting-in-tcp_sacktag_one.patch qed-handle-management-fw-error.patch dt-bindings-arm-fix-toradex-compatible-typo.patch