netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wireless: wext: terminate ifr name coming from userspace
@ 2017-07-18  4:23 Levin, Alexander (Sasha Levin)
  2017-07-19 20:33 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Levin, Alexander (Sasha Levin) @ 2017-07-18  4:23 UTC (permalink / raw)
  To: johannes.berg@intel.com, davem@davemloft.net
  Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Levin, Alexander (Sasha Levin)

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] wireless: wext: terminate ifr name coming from userspace
  2017-07-18  4:23 [PATCH] wireless: wext: terminate ifr name coming from userspace Levin, Alexander (Sasha Levin)
@ 2017-07-19 20:33 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-07-19 20:33 UTC (permalink / raw)
  To: alexander.levin; +Cc: johannes.berg, netdev, linux-kernel

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-19 20:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-18  4:23 [PATCH] wireless: wext: terminate ifr name coming from userspace Levin, Alexander (Sasha Levin)
2017-07-19 20:33 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).