All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ieee802154: Fix oops during ieee802154_sock_ioctl
@ 2010-04-26 14:46 Dmitry Eremin-Solenikov
  2010-04-26 18:20 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Eremin-Solenikov @ 2010-04-26 14:46 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, linux-kernel, Stefan Schmidt

From: Stefan Schmidt <stefan@datenfreihafen.org>

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>
---
 net/ieee802154/af_ieee802154.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c
index bad1c49..72340dd 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);
 
-- 
1.7.0


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

* Re: [PATCH] ieee802154: Fix oops during ieee802154_sock_ioctl
  2010-04-26 14:46 [PATCH] ieee802154: Fix oops during ieee802154_sock_ioctl Dmitry Eremin-Solenikov
@ 2010-04-26 18:20 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-04-26 18:20 UTC (permalink / raw)
  To: dbaryshkov; +Cc: netdev, linux-kernel, stefan

From: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Date: Mon, 26 Apr 2010 18:46:42 +0400

> From: Stefan Schmidt <stefan@datenfreihafen.org>
> 
> 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>

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

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

end of thread, other threads:[~2010-04-26 18:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-26 14:46 [PATCH] ieee802154: Fix oops during ieee802154_sock_ioctl Dmitry Eremin-Solenikov
2010-04-26 18:20 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.