[Devel] [PATCH RH7 04/32] Revert "ms/tun: Add ioctl() SIOCGSKNS cmd to allow obtaining net ns of tun device"

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Mon Jun 8 20:05:34 MSK 2020


This reverts commit 7cb9e7ae7041f348f2be384ea17352e117f3d00d.

We switch from procfs ns-files to nsfs ones, so we will apply nsfs
version of the patch instead.

https://jira.sw.ru/browse/PSBM-102357

Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 drivers/net/tun.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index c2bebdeab0bc..81b305abbf05 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -71,7 +71,6 @@
 #include <net/sock.h>
 #include <linux/skb_array.h>
 #include <linux/seq_file.h>
-#include <linux/proc_ns.h>
 
 #include <asm/uaccess.h>
 
@@ -2339,7 +2338,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
 	bool do_notify = false;
 
 	if (cmd == TUNSETIFF || cmd == TUNSETQUEUE || cmd == TUNSETACCTID ||
-	    (_IOC_TYPE(cmd) == 0x89 && cmd != SIOCGSKNS)) {
+			_IOC_TYPE(cmd) == 0x89) {
 		if (copy_from_user(&ifr, argp, ifreq_len))
 			return -EFAULT;
 	} else {
@@ -2391,14 +2390,6 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
 		tfile->ifindex = ifindex;
 		goto unlock;
 	}
-	if (cmd == SIOCGSKNS) {
-		ret = -EPERM;
-		if (!ns_capable(tfile->net->user_ns, CAP_NET_ADMIN))
-			goto unlock;
-
-		ret = open_net_ns_fd(tfile->net);
-		goto unlock;
-	}
 
 	ret = -EBADFD;
 	if (!tun)
-- 
2.24.1



More information about the Devel mailing list