summaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2023-10-26 17:05:58 +0200
committerJoerg Roedel <jroedel@suse.de>2023-10-26 17:05:58 +0200
commit3613047280ec42a4e1350fdc1a6dd161ff4008cc (patch)
tree6cf2f03f518537f3229e6066a8b2638755f0bb48 /drivers/net/tun.c
parentiommu/dart: Remove the force_bypass variable (diff)
parentLinux 6.6-rc7 (diff)
downloadlinux-3613047280ec42a4e1350fdc1a6dd161ff4008cc.tar.xz
linux-3613047280ec42a4e1350fdc1a6dd161ff4008cc.zip
Merge tag 'v6.6-rc7' into core
Linux 6.6-rc7
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 89ab9efe522c..afa5497f7c35 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -3073,10 +3073,11 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
struct net *net = sock_net(&tfile->sk);
struct tun_struct *tun;
void __user* argp = (void __user*)arg;
- unsigned int ifindex, carrier;
+ unsigned int carrier;
struct ifreq ifr;
kuid_t owner;
kgid_t group;
+ int ifindex;
int sndbuf;
int vnet_hdr_sz;
int le;
@@ -3132,7 +3133,9 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
ret = -EFAULT;
if (copy_from_user(&ifindex, argp, sizeof(ifindex)))
goto unlock;
-
+ ret = -EINVAL;
+ if (ifindex < 0)
+ goto unlock;
ret = 0;
tfile->ifindex = ifindex;
goto unlock;