[PATCH 13/19] backports: do not access user_ns on struct net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The ieee802154 subsystem wants to access user_ns on struct net, but
this member was added in kernel 3.8, check the general capabilities
instead.

Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 .../0044-no_user_ns_in_net/ieee802154.patch        | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 patches/collateral-evolutions/network/0044-no_user_ns_in_net/ieee802154.patch

diff --git a/patches/collateral-evolutions/network/0044-no_user_ns_in_net/ieee802154.patch b/patches/collateral-evolutions/network/0044-no_user_ns_in_net/ieee802154.patch
new file mode 100644
index 0000000..d5f951b
--- /dev/null
+++ b/patches/collateral-evolutions/network/0044-no_user_ns_in_net/ieee802154.patch
@@ -0,0 +1,30 @@
+--- a/net/ieee802154/dgram.c
++++ b/net/ieee802154/dgram.c
+@@ -483,8 +483,13 @@ static int dgram_setsockopt(struct sock
+ 		ro->want_ack = !!val;
+ 		break;
+ 	case WPAN_SECURITY:
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
+ 		if (!ns_capable(net->user_ns, CAP_NET_ADMIN) &&
+ 		    !ns_capable(net->user_ns, CAP_NET_RAW)) {
++#else
++		if (!capable(CAP_NET_ADMIN) &&
++		    !capable(CAP_NET_RAW)) {
++#endif
+ 			err = -EPERM;
+ 			break;
+ 		}
+@@ -507,8 +512,13 @@ static int dgram_setsockopt(struct sock
+ 		}
+ 		break;
+ 	case WPAN_SECURITY_LEVEL:
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)
+ 		if (!ns_capable(net->user_ns, CAP_NET_ADMIN) &&
+ 		    !ns_capable(net->user_ns, CAP_NET_RAW)) {
++#else
++		if (!capable(CAP_NET_ADMIN) &&
++		    !capable(CAP_NET_RAW)) {
++#endif
+ 			err = -EPERM;
+ 			break;
+ 		}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux