net: ethernet: ax88796: avoid null pointer dereference
authorxypron.glpk@gmx.de <xypron.glpk@gmx.de>
Sun, 31 Jul 2016 07:58:44 +0000 (09:58 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 Aug 2016 20:32:51 +0000 (13:32 -0700)
If platform_get_resource fails, mem2 is null.
Do not dereference null.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/8390/ax88796.c

index 5698f5354c0bbd5b27061635757c894d315f8a65..39ca9350d1b22d0d153f377e86a41212fa12d380 100644 (file)
@@ -910,7 +910,8 @@ static int ax_probe(struct platform_device *pdev)
        iounmap(ax->map2);
 
  exit_mem2:
-       release_mem_region(mem2->start, mem2_size);
+       if (mem2)
+               release_mem_region(mem2->start, mem2_size);
 
  exit_mem1:
        iounmap(ei_local->mem);