aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorKangjie Lu <kjlu@umn.edu>2019-03-12 02:16:21 -0500
committerDavid S. Miller <davem@davemloft.net>2019-03-12 14:48:35 -0700
commit9f4d6358e11bbc7b839f9419636188e4151fb6e4 (patch)
treee225aeb50ba736874e70b2e73cea54d568f1eabc /drivers/net/ethernet
parentnet: qlogic: fix a potential NULL pointer dereference (diff)
downloadlinux-dev-9f4d6358e11bbc7b839f9419636188e4151fb6e4.tar.xz
linux-dev-9f4d6358e11bbc7b839f9419636188e4151fb6e4.zip
net: fujitsu: fix a potential NULL pointer dereference
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>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/fujitsu/fmvj18x_cs.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/ethernet/fujitsu/fmvj18x_cs.c b/drivers/net/ethernet/fujitsu/fmvj18x_cs.c
index a69cd19a55ae..1eca0fdb9933 100644
--- a/drivers/net/ethernet/fujitsu/fmvj18x_cs.c
+++ b/drivers/net/ethernet/fujitsu/fmvj18x_cs.c
@@ -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);
/*