From: Levin, Alexander Date: Tue, 18 Jul 2017 04:23:16 +0000 (+0000) Subject: wireless: wext: terminate ifr name coming from userspace X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=98de4e0ea47d106846fc0e30ce4e644283fa7fc2;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git wireless: wext: terminate ifr name coming from userspace ifr name is assumed to be a valid string by the kernel, but nothing was forcing username to pass a valid string. In turn, this would cause panics as we tried to access the string past it's valid memory. Signed-off-by: Sasha Levin Signed-off-by: David S. Miller --- diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c index 82fd4c9c4a1b..7657ad6bc13d 100644 --- a/net/core/dev_ioctl.c +++ b/net/core/dev_ioctl.c @@ -424,6 +424,8 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg) if (copy_from_user(&iwr, arg, sizeof(iwr))) return -EFAULT; + iwr.ifr_name[sizeof(iwr.ifr_name) - 1] = 0; + return wext_handle_ioctl(net, &iwr, cmd, arg); }