kernel_samsung_a53x/drivers/net/arcnet
Tong Zhang bb40edc88d net: arcnet: com20020 fix error handling
[ Upstream commit 6577b9a551aedb86bca6d4438c28386361845108 ]

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>
Stable-dep-of: 6b17a597fc2f ("arcnet: restoring support for multiple Sohard Arcnet cards")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-18 12:11:39 +01:00
..
arc-rawmode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
arc-rimi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
arcdevice.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
arcnet.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
capmode.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
com90io.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
com90xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
com9026.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
com20020-isa.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
com20020-pci.c net: arcnet: com20020 fix error handling 2024-11-18 12:11:39 +01:00
com20020.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
com20020.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
com20020_cs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rfc1051.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rfc1201.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00