public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: Phil Sutter <phil.sutter@viprinet.com>
Cc: David Miller <davem@davemloft.net>, <netdev@vger.kernel.org>,
	<inaky.perez-gonzalez@intel.com>
Subject: Re: [PATCH 1/2] wimax: i2400m - prevent a possible kernel bug due to missing fw_name string
Date: Mon, 26 Mar 2012 15:57:10 +0100	[thread overview]
Message-ID: <1332773830.3500.88.camel@deadeye> (raw)
In-Reply-To: <1332761036-8913-1-git-send-email-phil.sutter@viprinet.com>

On Mon, 2012-03-26 at 13:23 +0200, Phil Sutter wrote:
> This happened on a machine with a custom hotplug script calling nameif,
> probably due to slow firmware loading. At the time nameif uses ethtool
> to gather interface information, i2400m->fw_name is zero and so a null
> pointer dereference occurs from within i2400m_get_drvinfo().
> 
> Signed-off-by: Phil Sutter <phil.sutter@viprinet.com>
> ---
>  drivers/net/wimax/i2400m/netdev.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c
> index 64a1106..020bd8d 100644
> --- a/drivers/net/wimax/i2400m/netdev.c
> +++ b/drivers/net/wimax/i2400m/netdev.c
> @@ -607,7 +607,8 @@ static void i2400m_get_drvinfo(struct net_device *net_dev,
>  	struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
>  
>  	strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1);
> -	strncpy(info->fw_version, i2400m->fw_name, sizeof(info->fw_version) - 1);
> +	strncpy(info->fw_version,
> +	        i2400m->fw_name ? : "N/A", sizeof(info->fw_version) - 1);

Use an empty string, not "N/A".

Ben.

>  	if (net_dev->dev.parent)
>  		strncpy(info->bus_info, dev_name(net_dev->dev.parent),
>  			sizeof(info->bus_info) - 1);

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

  parent reply	other threads:[~2012-03-26 14:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-26 11:23 [PATCH 1/2] wimax: i2400m - prevent a possible kernel bug due to missing fw_name string Phil Sutter
2012-03-26 11:23 ` [PATCH 2/2] wimax: i2400m-usb - use a private struct ethtool_ops Phil Sutter
2012-03-28  2:30   ` David Miller
2012-03-26 14:57 ` Ben Hutchings [this message]
2012-03-26 19:01   ` [PATCHv2 1/2] wimax: i2400m - prevent a possible kernel bug due to missing fw_name string Phil Sutter
2012-03-26 19:01     ` [PATCHv2 2/2] wimax: i2400m-usb - use a private struct ethtool_ops Phil Sutter
2012-03-28  2:30 ` [PATCH 1/2] wimax: i2400m - prevent a possible kernel bug due to missing fw_name string 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=1332773830.3500.88.camel@deadeye \
    --to=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=inaky.perez-gonzalez@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=phil.sutter@viprinet.com \
    /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