netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] netns: fix NULL-dereference in dev_net()
@ 2008-08-14 19:27 Brian Haley
  2008-08-14 19:55 ` [Devel] " Alexey Dobriyan
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Brian Haley @ 2008-08-14 19:27 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, containers

[-- Attachment #1: Type: text/plain, Size: 133 bytes --]

Change dev_net() to handle a NULL argument - return &init_net instead.

-Brian

Signed-off-by: Brian Haley <brian.haley@hp.com>
---


[-- Attachment #2: dev_net1.patch --]
[-- Type: text/x-patch, Size: 405 bytes --]

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 488c56e..baf6517 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -781,10 +781,10 @@ static inline
 struct net *dev_net(const struct net_device *dev)
 {
 #ifdef CONFIG_NET_NS
-	return dev->nd_net;
-#else
-	return &init_net;
+	if (dev)
+		return dev->nd_net;
 #endif
+	return &init_net;
 }
 
 static inline


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

end of thread, other threads:[~2008-08-17 22:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-14 19:27 [PATCH 1/2] netns: fix NULL-dereference in dev_net() Brian Haley
2008-08-14 19:55 ` [Devel] " Alexey Dobriyan
2008-08-14 20:01   ` Brian Haley
2008-08-14 20:20 ` Denis V. Lunev
2008-08-14 20:29   ` Brian Haley
2008-08-16 21:30 ` Daniel Lezcano
2008-08-17 22:34   ` 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).