Zhengchao Shao
cf2010aa1c
netdevsim: fix memory leak in nsim_bus_dev_new()
If device_register() failed in nsim_bus_dev_new(), the value of reference
in nsim_bus_dev->dev is 1. obj->name in nsim_bus_dev->dev will not be
released.
unreferenced object 0xffff88810352c480 (size 16):
comm "echo", pid 5691, jiffies 4294945921 (age 133.270s)
hex dump (first 16 bytes):
6e 65 74 64 65 76 73 69 6d 31 00 00 00 00 00 00 netdevsim1......
backtrace:
[<000000005e2e5e26>] __kmalloc_node_track_caller+0x3a/0xb0
[<0000000094ca4fc8>] kvasprintf+0xc3/0x160
[<00000000aad09bcc>] kvasprintf_const+0x55/0x180
[<000000009bac868d>] kobject_set_name_vargs+0x56/0x150
[<000000007c1a5d70>] dev_set_name+0xbb/0xf0
[<00000000ad0d126b>] device_add+0x1f8/0x1cb0
[<00000000c222ae24>] new_device_store+0x3b6/0x5e0
[<0000000043593421>] bus_attr_store+0x72/0xa0
[<00000000cbb1833a>] sysfs_kf_write+0x106/0x160
[<00000000d0dedb8a>] kernfs_fop_write_iter+0x3a8/0x5a0
[<00000000770b66e2>] vfs_write+0x8f0/0xc80
[<0000000078bb39be>] ksys_write+0x106/0x210
[<00000000005e55a4>] do_syscall_64+0x35/0x80
[<00000000eaa40bbc>] entry_SYSCALL_64_after_hwframe+0x46/0xb0
Fixes: 40e4fe4ce1 ("netdevsim: move device registration and related code to bus.c")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Link: https://lore.kernel.org/r/20221026015405.128795-1-shaozhengchao@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-10-27 10:47:09 -07:00
..
2022-10-21 18:08:30 -07:00
2022-10-10 09:10:28 -07:00
2022-10-18 08:02:14 +09:00
2022-10-12 10:23:24 -07:00
2022-10-12 10:23:24 -07:00
2022-10-21 15:14:14 -07:00
2022-10-08 08:56:37 -07:00
2022-10-17 10:20:04 -07:00
2022-10-16 11:08:19 -07:00
2022-10-10 10:16:00 -07:00
2022-10-08 09:46:29 -07:00
2022-10-18 16:22:26 +05:30
2022-10-09 13:24:01 -07:00
2022-10-10 13:04:25 -07:00
2022-10-14 18:41:41 -07:00
2022-10-11 17:42:58 -06:00
2022-10-06 17:22:11 -07:00
2022-10-13 11:07:13 -07:00
2022-10-08 08:56:37 -07:00
2022-10-21 11:09:41 +02:00
2022-10-08 08:56:37 -07:00
2022-09-28 21:10:57 +09:30
2022-10-12 10:23:24 -07:00
2022-10-21 12:33:03 -07:00
2022-10-21 17:41:57 -07:00
2022-10-10 13:59:01 -07:00
2022-10-23 10:01:34 -07:00
2022-10-08 08:56:37 -07:00
2022-10-21 07:59:35 +02:00
2022-10-12 23:45:29 +02:00
2022-10-08 08:56:37 -07:00
2022-10-11 17:42:58 -06:00
2022-10-11 10:53:25 -07:00
2022-10-21 10:49:35 +02:00
2022-10-08 08:56:37 -07:00
2022-10-12 10:23:24 -07:00
2022-10-09 19:11:54 +01:00
2022-10-14 13:14:03 -07:00
2022-10-09 14:05:15 -07:00
2022-10-05 21:51:58 -05:00
2022-10-18 17:17:48 -04:00
2022-10-22 15:30:15 -07:00
2022-10-23 12:04:56 -07:00
2022-10-11 17:42:58 -06:00
2022-10-16 15:27:07 -07:00
2022-10-16 15:27:07 -07:00
2022-10-27 10:47:09 -07:00
2022-10-20 21:13:04 -07:00
2022-10-14 18:41:41 -07:00
2022-10-21 15:14:14 -07:00
2022-10-10 13:13:51 -07:00
2022-10-14 12:10:01 -07:00
2022-10-17 12:11:09 -05:00
2022-10-14 12:38:03 -07:00
2022-10-11 11:08:18 -07:00
2022-10-18 10:42:10 +02:00
2022-10-12 10:35:20 -07:00
2022-10-10 18:11:11 +02:00
2022-10-07 11:48:30 -07:00
2022-10-10 09:10:28 -07:00
2022-10-10 08:37:24 +01:00
2022-10-07 11:32:10 -07:00
2022-10-07 11:24:20 -07:00
2022-10-05 09:20:44 -06:00
2022-10-08 10:06:48 -07:00
2022-10-14 18:36:42 -07:00
2022-10-14 11:36:05 -07:00
2022-10-18 02:42:08 +00:00
2022-10-13 11:07:13 -07:00
2022-10-07 16:13:55 -07:00
2022-10-04 19:36:53 -07:00
2022-09-30 14:33:23 +02:00
2022-10-22 15:30:15 -07:00
2022-10-11 17:42:58 -06:00
2022-10-10 17:53:04 -07:00
2022-10-15 19:33:57 +02:00
2022-10-11 17:42:58 -06:00
2022-10-14 12:10:01 -07:00
2022-10-07 12:33:18 -07:00
2022-10-10 17:53:04 -07:00
2022-10-10 14:02:53 -07:00
2022-10-12 14:46:48 -07:00
2022-10-10 14:02:53 -07:00
2022-10-16 15:27:07 -07:00
2022-10-08 08:56:37 -07:00
2022-10-13 09:33:03 -04:00
2022-10-08 08:56:37 -07:00
2022-10-21 12:25:39 -07:00
2022-10-21 14:43:09 -07:00