summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schmidt <stefan@datenfreihafen.org>2010-04-26 11:20:32 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-12 15:02:56 -0700
commit3aae65db0819a8f6bb440e12868986fc3891e96e (patch)
treed2734439cf39953eb3d15c2b873acdbf873ec150
parent5b0dede91684c855ab8e6abe7fa3513282f60fb6 (diff)
downloadlinux-stable-3aae65db0819a8f6bb440e12868986fc3891e96e.tar.gz
linux-stable-3aae65db0819a8f6bb440e12868986fc3891e96e.tar.bz2
linux-stable-3aae65db0819a8f6bb440e12868986fc3891e96e.zip
ieee802154: Fix oops during ieee802154_sock_ioctl
[ Upstream commit 93c0c8b4a5a174645550d444bd5c3ff0cccf74cb ] 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. Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--net/ieee802154/af_ieee802154.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c
index bad1c49fd960..72340ddb6afc 100644
--- a/net/ieee802154/af_ieee802154.c
+++ b/net/ieee802154/af_ieee802154.c
@@ -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);