]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 May 2020 12:35:11 +0000 (14:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 May 2020 12:35:11 +0000 (14:35 +0200)
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

queue-4.9/ib-cma-fix-reference-count-leak-when-no-ipv4-addresses-are-set.patch [new file with mode: 0644]
queue-4.9/series
queue-4.9/uapi-fix-linux-if_pppol2tp.h-userspace-compilation-errors.patch [new file with mode: 0644]

diff --git a/queue-4.9/ib-cma-fix-reference-count-leak-when-no-ipv4-addresses-are-set.patch b/queue-4.9/ib-cma-fix-reference-count-leak-when-no-ipv4-addresses-are-set.patch
new file mode 100644 (file)
index 0000000..f76f3e2
--- /dev/null
@@ -0,0 +1,47 @@
+From 963916fdb3e5ad4af57ac959b5a03bf23f7568ca Mon Sep 17 00:00:00 2001
+From: "Kalderon, Michal" <Michal.Kalderon@cavium.com>
+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 <Michal.Kalderon@cavium.com>
+
+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 <Michal.Kalderon@cavium.com>
+Signed-off-by: Ariel Elior <Ariel.Elior@cavium.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ 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
+@@ -208,11 +208,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);
+       }
+ }
index c54ccf610f8981ccfef5fe1be2f86753ff1b3090..14de1d44f6590b7b6272add502086b7a22aff2a5 100644 (file)
@@ -8,3 +8,5 @@ net-qrtr-fix-passing-invalid-reference-to-qrtr_local_enqueue.patch
 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.9/uapi-fix-linux-if_pppol2tp.h-userspace-compilation-errors.patch b/queue-4.9/uapi-fix-linux-if_pppol2tp.h-userspace-compilation-errors.patch
new file mode 100644 (file)
index 0000000..b5d3660
--- /dev/null
@@ -0,0 +1,55 @@
+From a725eb15db80643a160310ed6bcfd6c5a6c907f2 Mon Sep 17 00:00:00 2001
+From: "Dmitry V. Levin" <ldv@altlinux.org>
+Date: Wed, 15 Feb 2017 05:23:26 +0300
+Subject: uapi: fix linux/if_pppol2tp.h userspace compilation errors
+
+From: Dmitry V. Levin <ldv@altlinux.org>
+
+commit a725eb15db80643a160310ed6bcfd6c5a6c907f2 upstream.
+
+Because of <linux/libc-compat.h> interface limitations, <netinet/in.h>
+provided by libc cannot be included after <linux/in.h>, therefore any
+header that includes <netinet/in.h> cannot be included after <linux/in.h>.
+
+Change uapi/linux/l2tp.h, the last uapi header that includes
+<netinet/in.h>, to include <linux/in.h> and <linux/in6.h> instead of
+<netinet/in.h> 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 <ldv@altlinux.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Asbjoern Sloth Toennesen <asbjorn@asbjorn.st>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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 <linux/types.h>
+ #include <linux/socket.h>
+-#ifndef __KERNEL__
+-#include <netinet/in.h>
+-#endif
++#include <linux/in.h>
++#include <linux/in6.h>
+ #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)];