Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1689671 > unrolled thread

[PATCH] wireless: wext: terminate ifr name coming from userspace

Started by"Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
First post2017-07-18 06:30 +0200
Last post2017-07-19 22:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] wireless: wext: terminate ifr name coming from userspace "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> - 2017-07-18 06:30 +0200
    Re: [PATCH] wireless: wext: terminate ifr name coming from  userspace David Miller <davem@davemloft.net> - 2017-07-19 22:40 +0200

#1689671 — [PATCH] wireless: wext: terminate ifr name coming from userspace

From"Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
Date2017-07-18 06:30 +0200
Subject[PATCH] wireless: wext: terminate ifr name coming from userspace
Message-ID<u4sj0-67a-23@gated-at.bofh.it>
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 <alexander.levin@verizon.com>
---
 net/core/dev_ioctl.c   | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

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);
 	}
 
-- 
2.11.0

[toc] | [next] | [standalone]


#1692188 — Re: [PATCH] wireless: wext: terminate ifr name coming from userspace

FromDavid Miller <davem@davemloft.net>
Date2017-07-19 22:40 +0200
SubjectRe: [PATCH] wireless: wext: terminate ifr name coming from userspace
Message-ID<u53Vg-5jH-31@gated-at.bofh.it>
In reply to#1689671
From: "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>
Date: Tue, 18 Jul 2017 04:23:16 +0000

> 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 <alexander.levin@verizon.com>

Applied and queued up for -stable.

dev_ifname() has the same bug, I'll post a patch for that.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web