--- /dev/null
+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);
+ }
+ }
--- /dev/null
+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)];