From 522efcc65e228df941ce1b5bc4806b9c692666d1 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 29 May 2020 14:34:56 +0200 Subject: [PATCH] 4.4-stable patches added patches: ib-cma-fix-reference-count-leak-when-no-ipv4-addresses-are-set.patch uapi-fix-linux-if_pppol2tp.h-userspace-compilation-errors.patch --- ...-leak-when-no-ipv4-addresses-are-set.patch | 47 ++++++++++++++++ queue-4.4/series | 2 + ...ol2tp.h-userspace-compilation-errors.patch | 55 +++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 queue-4.4/ib-cma-fix-reference-count-leak-when-no-ipv4-addresses-are-set.patch create mode 100644 queue-4.4/uapi-fix-linux-if_pppol2tp.h-userspace-compilation-errors.patch diff --git a/queue-4.4/ib-cma-fix-reference-count-leak-when-no-ipv4-addresses-are-set.patch b/queue-4.4/ib-cma-fix-reference-count-leak-when-no-ipv4-addresses-are-set.patch new file mode 100644 index 00000000000..c4eabb1bf0e --- /dev/null +++ b/queue-4.4/ib-cma-fix-reference-count-leak-when-no-ipv4-addresses-are-set.patch @@ -0,0 +1,47 @@ +From 963916fdb3e5ad4af57ac959b5a03bf23f7568ca Mon Sep 17 00:00:00 2001 +From: "Kalderon, Michal" +Date: Thu, 6 Jul 2017 23:22:11 +0300 +Subject: IB/cma: Fix reference count leak when no ipv4 addresses are set + +From: Kalderon, Michal + +commit 963916fdb3e5ad4af57ac959b5a03bf23f7568ca upstream. + +Once in_dev_get is called to receive in_device pointer, the +in_device reference counter is increased, but if there are +no ipv4 addresses configured on the net-device the ifa_list +will be null, resulting in a flow that doesn't call in_dev_put +to decrease the ref_cnt. +This was exposed when running RoCE over ipv6 without any ipv4 +addresses configured + +Fixes: commit 8e3867310c90 ("IB/cma: Fix a race condition in iboe_addr_get_sgid()") + +Signed-off-by: Michal Kalderon +Signed-off-by: Ariel Elior +Signed-off-by: Doug Ledford +Cc: Guenter Roeck +Signed-off-by: Greg Kroah-Hartman + +--- + include/rdma/ib_addr.h | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/include/rdma/ib_addr.h ++++ b/include/rdma/ib_addr.h +@@ -200,11 +200,13 @@ static inline void iboe_addr_get_sgid(st + dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if); + if (dev) { + ip4 = in_dev_get(dev); +- if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address) { ++ if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address) + ipv6_addr_set_v4mapped(ip4->ifa_list->ifa_address, + (struct in6_addr *)gid); ++ ++ if (ip4) + in_dev_put(ip4); +- } ++ + dev_put(dev); + } + } diff --git a/queue-4.4/series b/queue-4.4/series index 654b4900714..86b3a62428f 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -4,3 +4,5 @@ sctp-start-shutdown-on-association-restart-if-in-shutdown-sent-state-and-socket- net-mlx5-add-command-entry-handling-completion.patch net-sun-fix-missing-release-regions-in-cas_init_one.patch net-mlx4_core-fix-a-memory-leak-bug.patch +uapi-fix-linux-if_pppol2tp.h-userspace-compilation-errors.patch +ib-cma-fix-reference-count-leak-when-no-ipv4-addresses-are-set.patch diff --git a/queue-4.4/uapi-fix-linux-if_pppol2tp.h-userspace-compilation-errors.patch b/queue-4.4/uapi-fix-linux-if_pppol2tp.h-userspace-compilation-errors.patch new file mode 100644 index 00000000000..b5d36605d4f --- /dev/null +++ b/queue-4.4/uapi-fix-linux-if_pppol2tp.h-userspace-compilation-errors.patch @@ -0,0 +1,55 @@ +From a725eb15db80643a160310ed6bcfd6c5a6c907f2 Mon Sep 17 00:00:00 2001 +From: "Dmitry V. Levin" +Date: Wed, 15 Feb 2017 05:23:26 +0300 +Subject: uapi: fix linux/if_pppol2tp.h userspace compilation errors + +From: Dmitry V. Levin + +commit a725eb15db80643a160310ed6bcfd6c5a6c907f2 upstream. + +Because of interface limitations, +provided by libc cannot be included after , therefore any +header that includes cannot be included after . + +Change uapi/linux/l2tp.h, the last uapi header that includes +, to include and instead of + and use __SOCK_SIZE__ instead of sizeof(struct sockaddr) +the same way as uapi/linux/in.h does, to fix linux/if_pppol2tp.h userspace +compilation errors like this: + +In file included from /usr/include/linux/l2tp.h:12:0, + from /usr/include/linux/if_pppol2tp.h:21, +/usr/include/netinet/in.h:31:8: error: redefinition of 'struct in_addr' + +Fixes: 47c3e7783be4 ("net: l2tp: deprecate PPPOL2TP_MSG_* in favour of L2TP_MSG_*") +Signed-off-by: Dmitry V. Levin +Signed-off-by: David S. Miller +Signed-off-by: Asbjoern Sloth Toennesen +Signed-off-by: Greg Kroah-Hartman +--- + include/uapi/linux/l2tp.h | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +--- a/include/uapi/linux/l2tp.h ++++ b/include/uapi/linux/l2tp.h +@@ -9,9 +9,8 @@ + + #include + #include +-#ifndef __KERNEL__ +-#include +-#endif ++#include ++#include + + #define IPPROTO_L2TP 115 + +@@ -31,7 +30,7 @@ struct sockaddr_l2tpip { + __u32 l2tp_conn_id; /* Connection ID of tunnel */ + + /* Pad to size of `struct sockaddr'. */ +- unsigned char __pad[sizeof(struct sockaddr) - ++ unsigned char __pad[__SOCK_SIZE__ - + sizeof(__kernel_sa_family_t) - + sizeof(__be16) - sizeof(struct in_addr) - + sizeof(__u32)]; -- 2.47.3