netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix netdev_printk null dereference
@ 2010-03-05 12:47 Steve Glendinning
  2010-03-05 14:39 ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Steve Glendinning @ 2010-03-05 12:47 UTC (permalink / raw)
  To: netdev

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@smsc.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


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

end of thread, other threads:[~2010-03-05 16:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-05 12:47 [PATCH] Fix netdev_printk null dereference Steve Glendinning
2010-03-05 14:39 ` David Miller
2010-03-05 14:50   ` Joe Perches
2010-03-05 15:03     ` David Miller
2010-03-05 15:29   ` Steve.Glendinning
2010-03-05 15:43     ` David Miller
2010-03-05 16:32       ` Steve.Glendinning
2010-03-05 16:42         ` 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).