From: Keiichi KII <k-keiichi@bx.jp.nec.com>
To: Matt Mackall <mpm@selenic.com>
Cc: Satyam Sharma <satyam.sharma@gmail.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Netdev <netdev@vger.kernel.org>,
David Miller <davem@davemloft.net>,
Stephen Hemminger <shemminger@linux-foundation.org>
Subject: [PATCH] netconsole: avoid null pointer dereference at show_local_mac()
Date: Fri, 15 Feb 2008 18:45:48 +0900 [thread overview]
Message-ID: <47B55F4C.5080703@bx.jp.nec.com> (raw)
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
next reply other threads:[~2008-02-15 9:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-15 9:45 Keiichi KII [this message]
2008-02-15 10:02 ` [PATCH] netconsole: avoid null pointer dereference at show_local_mac() David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47B55F4C.5080703@bx.jp.nec.com \
--to=k-keiichi@bx.jp.nec.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
--cc=netdev@vger.kernel.org \
--cc=satyam.sharma@gmail.com \
--cc=shemminger@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox