Yang Yingliang
91f8f5342b
net: hns: fix possible memory leak in hnae_ae_register()
[ Upstream commit ff2f5ec5d009844ec28f171123f9e58750cef4bf ]
Inject fault while probing module, if device_register() fails,
but the refcount of kobject is not decreased to 0, the name
allocated in dev_set_name() is leaked. Fix this by calling
put_device(), so that name can be freed in callback function
kobject_cleanup().
unreferenced object 0xffff00c01aba2100 (size 128):
comm "systemd-udevd", pid 1259, jiffies 4294903284 (age 294.152s)
hex dump (first 32 bytes):
68 6e 61 65 30 00 00 00 18 21 ba 1a c0 00 ff ff hnae0....!......
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<0000000034783f26>] slab_post_alloc_hook+0xa0/0x3e0
[<00000000748188f2>] __kmem_cache_alloc_node+0x164/0x2b0
[<00000000ab0743e8>] __kmalloc_node_track_caller+0x6c/0x390
[<000000006c0ffb13>] kvasprintf+0x8c/0x118
[<00000000fa27bfe1>] kvasprintf_const+0x60/0xc8
[<0000000083e10ed7>] kobject_set_name_vargs+0x3c/0xc0
[<000000000b87affc>] dev_set_name+0x7c/0xa0
[<000000003fd8fe26>] hnae_ae_register+0xcc/0x190 [hnae]
[<00000000fe97edc9>] hns_dsaf_ae_init+0x9c/0x108 [hns_dsaf]
[<00000000c36ff1eb>] hns_dsaf_probe+0x548/0x748 [hns_dsaf]
Fixes: 6fe6611ff2 ("net: add Hisilicon Network Subsystem hnae framework support")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20221018122451.1749171-1-yangyingliang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-10-29 10:12:57 +02:00
..
2022-04-08 14:22:47 +02:00
2022-06-14 18:36:19 +02:00
2022-01-11 15:35:15 +01:00
2022-03-08 19:12:41 +01:00
2022-03-28 09:58:44 +02:00
2022-10-12 09:53:27 +02:00
2022-03-08 19:12:41 +01:00
2022-10-26 12:34:47 +02:00
2022-10-26 12:34:49 +02:00
2022-06-09 10:23:01 +02:00
2022-10-05 10:39:43 +02:00
2022-09-08 12:28:07 +02:00
2022-05-25 09:57:35 +02:00
2022-07-29 17:25:21 +02:00
2022-03-08 19:12:41 +01:00
2022-07-21 21:24:28 +02:00
2022-10-26 12:34:44 +02:00
2022-09-08 12:28:07 +02:00
2022-10-29 10:12:57 +02:00
2022-09-08 12:28:07 +02:00
2022-01-27 11:05:43 +01:00
2022-07-12 16:35:16 +02:00
2022-10-29 10:12:55 +02:00
2022-03-08 19:12:41 +01:00
2022-10-26 12:34:50 +02:00
2022-06-22 14:21:58 +02:00
2022-10-12 09:53:28 +02:00
2022-04-20 09:34:15 +02:00
2022-09-08 12:28:02 +02:00
2022-09-28 11:11:44 +02:00
2022-08-31 17:16:39 +02:00
2022-07-02 16:41:18 +02:00
2022-04-20 09:34:16 +02:00
2022-09-08 12:28:07 +02:00
2022-03-16 14:23:38 +01:00
2022-10-29 10:12:56 +02:00
2022-07-12 16:34:53 +02:00
2022-07-12 16:35:16 +02:00
2022-09-28 11:11:52 +02:00
2022-09-08 12:28:02 +02:00
2022-03-08 19:12:46 +01:00
2022-10-29 10:12:57 +02:00
2022-09-08 12:28:02 +02:00
2022-10-05 10:39:43 +02:00
2022-09-28 11:11:53 +02:00
2022-10-26 12:35:54 +02:00
2022-05-18 10:26:52 +02:00
2022-06-09 10:22:46 +02:00
2022-04-27 14:38:53 +02:00
2022-01-05 12:42:35 +01:00