Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1737433
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] e1000: avoid null pointer dereference on invalid stat type |
| Date | 2017-09-22 14:00 +0200 |
| Message-ID | <usuMF-5Em-9@gated-at.bofh.it> (permalink) |
| References | <ushPr-6zK-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] e1000: avoid null pointer dereference on invalid stat type Colin King <colin.king@canonical.com> - 2017-09-22 00:10 +0200
Re: [PATCH] e1000: avoid null pointer dereference on invalid stat type Dan Carpenter <dan.carpenter@oracle.com> - 2017-09-22 14:00 +0200
Re: [PATCH] e1000: avoid null pointer dereference on invalid stat type Colin Ian King <colin.king@canonical.com> - 2017-09-22 14:00 +0200
csiph-web