linux-stable/drivers/atm
Li Zetao 19aa85b9df atm: idt77252: fix kmemleak when rmmod idt77252
[ Upstream commit 4fe3c88552 ]

There are memory leaks reported by kmemleak:

  unreferenced object 0xffff888106500800 (size 128):
    comm "modprobe", pid 1017, jiffies 4297787785 (age 67.152s)
    hex dump (first 32 bytes):
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    backtrace:
      [<00000000970ce626>] __kmem_cache_alloc_node+0x20c/0x380
      [<00000000fb5f78d9>] kmalloc_trace+0x2f/0xb0
      [<000000000e947e2a>] idt77252_init_one+0x2847/0x3c90 [idt77252]
      [<000000006efb048e>] local_pci_probe+0xeb/0x1a0
    ...

  unreferenced object 0xffff888106500b00 (size 128):
    comm "modprobe", pid 1017, jiffies 4297787785 (age 67.152s)
    hex dump (first 32 bytes):
      00 20 3d 01 80 88 ff ff 00 20 3d 01 80 88 ff ff  . =...... =.....
      f0 23 3d 01 80 88 ff ff 00 20 3d 01 00 00 00 00  .#=...... =.....
    backtrace:
      [<00000000970ce626>] __kmem_cache_alloc_node+0x20c/0x380
      [<00000000fb5f78d9>] kmalloc_trace+0x2f/0xb0
      [<00000000f451c5be>] alloc_scq.constprop.0+0x4a/0x400 [idt77252]
      [<00000000e6313849>] idt77252_init_one+0x28cf/0x3c90 [idt77252]

The root cause is traced to the vc_maps which alloced in open_card_oam()
are not freed in close_card_oam(). The vc_maps are used to record
open connections, so when close a vc_map in close_card_oam(), the memory
should be freed. Moreover, the ubr0 is not closed when close a idt77252
device, leading to the memory leak of vc_map and scq_info.

Fix them by adding kfree in close_card_oam() and implementing new
close_card_ubr0() to close ubr0.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Francois Romieu <romieu@fr.zoreil.com>
Link: https://lore.kernel.org/r/20230320143318.2644630-1-lizetao1@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-05 11:23:35 +02:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
adummy.c
ambassador.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 37 2019-05-24 17:27:11 +02:00
ambassador.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 37 2019-05-24 17:27:11 +02:00
atmtcp.c atm: atmtcp: Constify atmtcp_v_dev_ops 2020-09-28 16:03:30 -07:00
eni.c atm: eni: Add check for dma_map_single 2022-03-23 09:13:27 +01:00
eni.h
firestream.c atm: firestream: check the return value of ioremap() in fs_init() 2022-03-19 13:44:45 +01:00
firestream.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 37 2019-05-24 17:27:11 +02:00
fore200e.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
fore200e.h
he.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
he.h
horizon.c net/atm: remove the atmdev_ops {get, set}sockopt methods 2020-07-19 18:16:40 -07:00
horizon.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 37 2019-05-24 17:27:11 +02:00
idt77105.c atm: idt77252: fix null-ptr-dereference 2021-03-30 14:31:50 +02:00
idt77105.h
idt77252.c atm: idt77252: fix kmemleak when rmmod idt77252 2023-04-05 11:23:35 +02:00
idt77252.h
idt77252_tables.h
iphase.c atm: iphase: fix possible use-after-free in ia_module_exit() 2021-07-19 09:44:38 +02:00
iphase.h
Kconfig docs: networking: move ATM drivers to the hw driver section 2020-06-26 16:08:45 -07:00
lanai.c atm: lanai: dont run lanai_dev_close if not open 2021-03-30 14:31:48 +02:00
Makefile
midway.h
nicstar.c atm: nicstar: register the interrupt handler in the right place 2021-07-19 09:44:52 +02:00
nicstar.h
nicstarmac.c
nicstarmac.copyright
solos-attrlist.c
solos-pci.c net/atm: remove the atmdev_ops {get, set}sockopt methods 2020-07-19 18:16:40 -07:00
suni.c
suni.h
tonga.h
uPD98401.h
uPD98402.c atm: uPD98402: fix incorrect allocation 2021-03-30 14:31:50 +02:00
uPD98402.h
zatm.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
zatm.h
zeprom.h