Skip to contentSkip to conversation

ieee802154: Fix oops during ieee802154_sock_ioctl

PATCH Applied Dmitry Eremin-Solenikov 2 participants 2 messages Apr 26, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ieee802154: Fix oops during ieee802154_sock_ioctl

From: Stefan Schmidt <[email protected]>

Trying to run izlisten (from lowpan-tools tests) on a device that does not exists I got the oops below. The problem is that we are using get_dev_by_name without checking if we really get a device back. We don't in this case and writing to dev->type generates this oops.

[Oops code removed by Dmitry Eremin-Solenikov]

If possible this patch should be applied to the current -rc fixes branch.

---
 net/ieee802154/af_ieee802154.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
net/ieee802154/af_ieee802154.c +3 -0
index bad1c49..72340dd 100644
@@ -147,6 +147,9 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,
 	dev_load(sock_net(sk), ifr.ifr_name);
 	dev = dev_get_by_name(sock_net(sk), ifr.ifr_name);
 
+	if (!dev)
+		return -ENODEV;
+
 	if (dev->type == ARPHRD_IEEE802154 && dev->netdev_ops->ndo_do_ioctl)
 		ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd);
 
Signature · 1 line
1.7.0
maintainer Applied
#1 lore raw

From: Dmitry Eremin-Solenikov <[email protected]>
Date: Mon, 26 Apr 2010 18:46:42 +0400

Quoted 7 lines

From: Stefan Schmidt <[email protected]>

Trying to run izlisten (from lowpan-tools tests) on a device that does not exists I got the oops below. The problem is that we are using get_dev_by_name without checking if we really get a device back. We don't in this case and writing to dev->type generates this oops.

Quoted 6 lines

[Oops code removed by Dmitry Eremin-Solenikov]

If possible this patch should be applied to the current -rc fixes branch.

Applied, and queued up for -stable too, thanks guys.