]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: fddi: fix UAF in fza_probe
authorPavel Skripkin <paskripkin@gmail.com>
Tue, 13 Jul 2021 10:58:53 +0000 (13:58 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Jul 2021 16:43:50 +0000 (09:43 -0700)
fp is netdev private data and it cannot be
used after free_netdev() call. Using fp after free_netdev()
can cause UAF bug. Fix it by moving free_netdev() after error message.

Fixes: b250e15d5a10 ("FDDI: defza: Add support for DEC FDDIcontroller 700
TURBOchannel adapter")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/fddi/defza.c

index 14f07050b6b1b96ac0f3c7e3f76931cf4990e7d8..0de2c4552f5eb34b8f2ca47d1909ca06def3f50a 100644 (file)
@@ -1504,9 +1504,8 @@ err_out_resource:
        release_mem_region(start, len);
 
 err_out_kfree:
-       free_netdev(dev);
-
        pr_err("%s: initialization failure, aborting!\n", fp->name);
+       free_netdev(dev);
        return ret;
 }