netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: Fix oops in dev_ifsioc()
@ 2008-12-19  7:04 Jarek Poplawski
  2008-12-19  8:02 ` Wang Chen
  2008-12-23  3:35 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Jarek Poplawski @ 2008-12-19  7:04 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

A command like this: "brctl addif br1 eth1" issued as a user gave me
an oops when bridge module wasn't loaded. It's caused by using a dev
pointer before checking for NULL.

Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---

 net/core/dev.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 048cf11..daca72e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3745,11 +3745,13 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd)
 {
 	int err;
 	struct net_device *dev = __dev_get_by_name(net, ifr->ifr_name);
-	const struct net_device_ops *ops = dev->netdev_ops;
+	const struct net_device_ops *ops;
 
 	if (!dev)
 		return -ENODEV;
 
+	ops = dev->netdev_ops;
+
 	switch (cmd) {
 		case SIOCSIFFLAGS:	/* Set interface flags */
 			return dev_change_flags(dev, ifr->ifr_flags);

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

end of thread, other threads:[~2008-12-23  3:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-19  7:04 [PATCH] net: Fix oops in dev_ifsioc() Jarek Poplawski
2008-12-19  8:02 ` Wang Chen
2008-12-19  8:11   ` Jarek Poplawski
2008-12-19  8:14     ` Wang Chen
2008-12-19  8:33       ` Julia Lawall
2008-12-23  3:35 ` 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).