linux/drivers/atm
Li Zetao 4a8286baf2 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-03-30 12:47:48 +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:16:41 +01:00
eni.h
firestream.c atm: firestream: check the return value of ioremap() in fs_init() 2022-03-19 13:47:49 +01:00
firestream.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 37 2019-05-24 17:27:11 +02:00
fore200e.c atm: fore200e: Fix fall-through warnings for Clang 2021-05-17 18:50:49 -05:00
fore200e.h
he.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
he.h
horizon.c atm: horizon: Fix spelling mistakes in TX comment 2021-08-08 12:58:42 +01: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-08 15:16:30 -08:00
idt77105.h
idt77252_tables.h
idt77252.c atm: idt77252: fix kmemleak when rmmod idt77252 2023-03-30 12:47:48 +02:00
idt77252.h atm: idt77252: fix build broken on amd64 2021-02-15 12:36:27 -08:00
iphase.c atm: iphase: fix possible use-after-free in ia_module_exit() 2021-05-11 16:12:03 -07:00
iphase.h atm: Replace custom isprint() with generic analogue 2021-05-10 14:51:01 -07:00
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-01 13:18:54 -08:00
Makefile
midway.h
nicstar.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-06-29 15:45:27 -07: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 atm: delete include/linux/atm_suni.h 2021-03-15 12:43:10 -07:00
suni.h
tonga.h
uPD98401.h
uPD98402.c atm: uPD98402: fix incorrect allocation 2021-03-08 15:16:30 -08:00
uPD98402.h
zatm.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
zatm.h
zeprom.h atm: Fix typo 2021-05-21 13:55:32 -07:00