lkml.org 
[lkml]   [2019]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2] net: 8390: fix potential NULL pointer dereferences
From
From: Kangjie Lu <kjlu@umn.edu>
Date: Mon, 11 Mar 2019 00:16:51 -0500

> In case ioremap fails, the fix returns to avoid NULL pointer
> dereferences.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> drivers/net/ethernet/8390/pcnet_cs.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/net/ethernet/8390/pcnet_cs.c b/drivers/net/ethernet/8390/pcnet_cs.c
> index 61e43802b9a5..e2b69e214fad 100644
> --- a/drivers/net/ethernet/8390/pcnet_cs.c
> +++ b/drivers/net/ethernet/8390/pcnet_cs.c
> @@ -289,6 +289,9 @@ static struct hw_info *get_hwinfo(struct pcmcia_device *link)
>
> virt = ioremap(link->resource[2]->start,
> resource_size(link->resource[2]));
> + if (unlikely(!virt))
> + return NULL;
> +

You have to release the pcmcia window if you bail here.

\
 
 \ /
  Last update: 2019-03-11 19:51    [W:0.030 / U:0.740 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site