Skip to content

Commit

Permalink
net: fujitsu: fix a potential NULL pointer dereference
Browse files Browse the repository at this point in the history
In case ioremap fails, the fix releases the pcmcia window and
returns -ENOMEM to avoid the NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
kengiter authored and davem330 committed Mar 12, 2019
1 parent eb32cfc commit 9f4d635
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/ethernet/fujitsu/fmvj18x_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,11 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
return -1;

base = ioremap(link->resource[2]->start, resource_size(link->resource[2]));
if (!base) {
pcmcia_release_window(link, link->resource[2]);
return -ENOMEM;
}

pcmcia_map_mem_page(link, link->resource[2], 0);

/*
Expand Down

0 comments on commit 9f4d635

Please sign in to comment.