[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1267793225-426-1-git-send-email-steve.glendinning@smsc.com>
Date: Fri, 5 Mar 2010 12:47:05 +0000
From: Steve Glendinning <steve.glendinning@...c.com>
To: netdev@...r.kernel.org
Subject: [PATCH] Fix netdev_printk null dereference
This patch fixes a reproducible null dereference in smsc95xx (and I
suspect others) when the device is removed during a control register
access. This can be reproduced by rapidly plugging and unplugging
the device during its initialisation.
Signed-off-by: Steve Glendinning <steve.glendinning@...c.com>
---
include/linux/netdevice.h | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index c79a88b..250dbc0 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2132,9 +2132,10 @@ static inline const char *netdev_name(const struct net_device *dev)
}
#define netdev_printk(level, netdev, format, args...) \
- dev_printk(level, (netdev)->dev.parent, \
+ ({ if ((netdev)->dev.parent) \
+ dev_printk(level, (netdev)->dev.parent, \
"%s: " format, \
- netdev_name(netdev), ##args)
+ netdev_name(netdev), ##args); })
#define netdev_emerg(dev, format, args...) \
netdev_printk(KERN_EMERG, dev, format, ##args)
--
1.6.6.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists