LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] netconsole: avoid null pointer dereference at show_local_mac()
@ 2008-02-15 9:45 Keiichi KII
2008-02-15 10:02 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Keiichi KII @ 2008-02-15 9:45 UTC (permalink / raw)
To: Matt Mackall
Cc: Satyam Sharma, Linux Kernel Mailing List, Netdev, David Miller,
Stephen Hemminger
From: Keiichi KII <k-keiichi@bx.jp.nec.com>
This patch avoids a null pointer dereference when we read local_mac
for netconsole in configfs and shows default local mac address
value.
A null pointer dereference occurs when we call show_local_mac() via
local_mac entry in configfs before we setup the content of netpoll
using netpoll_setup().
This patch is for 2.6.25-rc1.
Your comments are very welcome.
Signed-off-by: Keiichi KII <k-keiichi@bx.jp.nec.com>
---
Index: pre-release/drivers/net/netconsole.c
===================================================================
--- pre-release.orig/drivers/net/netconsole.c
+++ pre-release/drivers/net/netconsole.c
@@ -309,8 +309,8 @@ static ssize_t show_local_mac(struct net
struct net_device *dev = nt->np.dev;
DECLARE_MAC_BUF(mac);
- return snprintf(buf, PAGE_SIZE, "%s\n",
- print_mac(mac, dev->dev_addr));
+ return snprintf(buf, PAGE_SIZE, "%s\n", dev ?
+ print_mac(mac, dev->dev_addr) : "ff:ff:ff:ff:ff:ff");
}
static ssize_t show_remote_mac(struct netconsole_target *nt, char *buf)
--
Keiichi KII
NEC Corporation OSS Platform Development Division
E-mail: k-keiichi@bx.jp.nec.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] netconsole: avoid null pointer dereference at show_local_mac()
2008-02-15 9:45 [PATCH] netconsole: avoid null pointer dereference at show_local_mac() Keiichi KII
@ 2008-02-15 10:02 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-02-15 10:02 UTC (permalink / raw)
To: k-keiichi; +Cc: mpm, satyam.sharma, linux-kernel, netdev, shemminger
From: Keiichi KII <k-keiichi@bx.jp.nec.com>
Date: Fri, 15 Feb 2008 18:45:48 +0900
> This patch avoids a null pointer dereference when we read local_mac
> for netconsole in configfs and shows default local mac address
> value.
>
> A null pointer dereference occurs when we call show_local_mac() via
> local_mac entry in configfs before we setup the content of netpoll
> using netpoll_setup().
>
> This patch is for 2.6.25-rc1.
> Your comments are very welcome.
>
> Signed-off-by: Keiichi KII <k-keiichi@bx.jp.nec.com>
Patch applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-02-15 10:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-15 9:45 [PATCH] netconsole: avoid null pointer dereference at show_local_mac() Keiichi KII
2008-02-15 10:02 ` 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).