1
0
Fork 0
alistair23-linux/drivers/net/arcnet
Tong Zhang 6577b9a551 net: arcnet: com20020 fix error handling
There are two issues when handling error case in com20020pci_probe()

1. priv might be not initialized yet when calling com20020pci_remove()
from com20020pci_probe(), since the priv is set at the very last but it
can jump to error handling in the middle and priv remains NULL.
2. memory leak - the net device is allocated in alloc_arcdev but not
properly released if error happens in the middle of the big for loop

[    1.529110] BUG: kernel NULL pointer dereference, address: 0000000000000008
[    1.531447] RIP: 0010:com20020pci_remove+0x15/0x60 [com20020_pci]
[    1.536805] Call Trace:
[    1.536939]  com20020pci_probe+0x3f2/0x48c [com20020_pci]
[    1.537226]  local_pci_probe+0x48/0x80
[    1.539918]  com20020pci_init+0x3f/0x1000 [com20020_pci]

Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-03-14 14:17:48 -07:00
..
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
arc-rawmode.c networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00
arc-rimi.c net: arcnet: Fix RESET flag handling 2021-01-29 20:54:06 -08:00
arcdevice.h net: arcnet: Fix RESET flag handling 2021-01-29 20:54:06 -08:00
arcnet.c arcnet: use new tasklet API 2021-02-02 15:51:17 -08:00
capmode.c arcnet: capmode: remove redundant assignment to pointer pkt 2019-08-30 14:14:46 -07:00
com90io.c net: arcnet: Fix RESET flag handling 2021-01-29 20:54:06 -08:00
com90xx.c net: arcnet: Fix RESET flag handling 2021-01-29 20:54:06 -08:00
com9026.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
com20020-isa.c net: arcnet: Fix RESET flag handling 2021-01-29 20:54:06 -08:00
com20020-pci.c net: arcnet: com20020 fix error handling 2021-03-14 14:17:48 -07:00
com20020.c arcnet: com20020: remove needless base_addr assignment 2017-06-29 15:18:36 -04:00
com20020.h arcnet: com20020-pci: add led trigger support 2015-10-26 09:10:56 +01:00
com20020_cs.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-02-02 14:21:31 -08:00
rfc1051.c networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00
rfc1201.c networking: make skb_push & __skb_push return void pointers 2017-06-16 11:48:40 -04:00