[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ea758981-9329-9594-5e25-f75376bc61a5@canonical.com>
Date: Fri, 22 Sep 2017 12:55:16 +0100
From: Colin Ian King <colin.king@...onical.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] e1000: avoid null pointer dereference on invalid stat
type
On 22/09/17 12:50, Dan Carpenter wrote:
> On Thu, Sep 21, 2017 at 11:01:58PM +0100, Colin King wrote:
>> @@ -1837,12 +1838,13 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
>> p = (char *)adapter + stat->stat_offset;
>> break;
>> default:
>> + p = NULL;
>> WARN_ONCE(1, "Invalid E1000 stat type: %u index %d\n",
>> stat->type, i);
>> break;
>> }
>>
>> - if (stat->sizeof_stat == sizeof(u64))
>> + if (p && stat->sizeof_stat == sizeof(u64))
>> data[i] = *(u64 *)p;
>> else
>> data[i] = *(u32 *)p;
> ^^^^^^^^
>
> The else side will still crash.
>
> regards,
> dan carpenter
>
Thanks, stupid me. I'll fix that up.
Powered by blists - more mailing lists