[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <47B55F4C.5080703@bx.jp.nec.com>
Date: Fri, 15 Feb 2008 18:45:48 +0900
From: Keiichi KII <k-keiichi@...jp.nec.com>
To: Matt Mackall <mpm@...enic.com>
CC: Satyam Sharma <satyam.sharma@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Netdev <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Stephen Hemminger <shemminger@...ux-foundation.org>
Subject: [PATCH] netconsole: avoid null pointer dereference at show_local_mac()
From: Keiichi KII <k-keiichi@...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@...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@...jp.nec.com
--
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