Message ID | 20230320143318.2644630-1-lizetao1@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 4fe3c88552a3fbe1944426a4506a18cdeb457b5a |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [v2] atm: idt77252: fix kmemleak when rmmod idt77252 | expand |
Hello: This patch was applied to netdev/net.git (main) by Jakub Kicinski <kuba@kernel.org>: On Mon, 20 Mar 2023 14:33:18 +0000 you wrote: > 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 > ... > > [...] Here is the summary with links: - [v2] atm: idt77252: fix kmemleak when rmmod idt77252 https://git.kernel.org/netdev/net/c/4fe3c88552a3 You are awesome, thank you!
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index eec0cc2144e0..e327a0229dc1 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c @@ -2909,6 +2909,7 @@ close_card_oam(struct idt77252_dev *card) recycle_rx_pool_skb(card, &vc->rcv.rx_pool); } + kfree(vc); } } } @@ -2952,6 +2953,15 @@ open_card_ubr0(struct idt77252_dev *card) return 0; } +static void +close_card_ubr0(struct idt77252_dev *card) +{ + struct vc_map *vc = card->vcs[0]; + + free_scq(card, vc->scq); + kfree(vc); +} + static int idt77252_dev_open(struct idt77252_dev *card) { @@ -3001,6 +3011,7 @@ static void idt77252_dev_close(struct atm_dev *dev) struct idt77252_dev *card = dev->dev_data; u32 conf; + close_card_ubr0(card); close_card_oam(card); conf = SAR_CFG_RXPTH | /* enable receive path */