Ira Weiny
ef3d5cf9c5
cxl/pmu: Ensure put_device on pmu devices
The following kmemleaks were detected when removing the cxl module
stack:
unreferenced object 0xffff88822616b800 (size 1024):
...
backtrace:
[<00000000bedc6f83>] kmalloc_trace+0x26/0x90
[<00000000448d1afc>] devm_cxl_pmu_add+0x3a/0x110 [cxl_core]
[<00000000ca3bfe16>] 0xffffffffa105213b
[<00000000ba7f78dc>] local_pci_probe+0x41/0x90
[<000000005bb027ac>] pci_device_probe+0xb0/0x1c0
...
unreferenced object 0xffff8882260abcc0 (size 16):
...
hex dump (first 16 bytes):
70 6d 75 5f 6d 65 6d 30 2e 30 00 26 82 88 ff ff pmu_mem0.0.&....
backtrace:
...
[<00000000152b5e98>] dev_set_name+0x43/0x50
[<00000000c228798b>] devm_cxl_pmu_add+0x102/0x110 [cxl_core]
[<00000000ca3bfe16>] 0xffffffffa105213b
[<00000000ba7f78dc>] local_pci_probe+0x41/0x90
[<000000005bb027ac>] pci_device_probe+0xb0/0x1c0
...
unreferenced object 0xffff8882272af200 (size 256):
...
backtrace:
[<00000000bedc6f83>] kmalloc_trace+0x26/0x90
[<00000000a14d1813>] device_add+0x4ea/0x890
[<00000000a3f07b47>] devm_cxl_pmu_add+0xbe/0x110 [cxl_core]
[<00000000ca3bfe16>] 0xffffffffa105213b
[<00000000ba7f78dc>] local_pci_probe+0x41/0x90
[<000000005bb027ac>] pci_device_probe+0xb0/0x1c0
...
devm_cxl_pmu_add() correctly registers a device remove function but it
only calls device_del() which is only part of device unregistration.
Properly call device_unregister() to free up the memory associated with
the device.
Fixes: 1ad3f701c3 ("cxl/pci: Find and register CXL PMU devices")
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/20231016-pmu-unregister-fix-v1-1-1e2eb2fa3c69@intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2023-12-14 21:54:45 -08:00
..
2023-11-15 11:03:49 +01:00
2023-11-08 09:21:18 -08:00
2023-11-03 14:51:08 -10:00
2023-11-08 09:00:49 +09:00
2023-11-02 14:05:18 -10:00
2023-11-07 16:56:10 -08:00
2023-11-07 08:14:57 -07:00
2023-10-23 11:04:51 -07:00
2023-11-01 14:46:51 -10:00
2023-10-26 09:42:37 +02:00
2023-11-03 14:51:08 -10:00
2023-11-03 14:51:08 -10:00
2023-11-01 14:46:51 -10:00
2023-11-10 09:23:17 -08:00
2023-10-24 10:53:45 +02:00
2023-11-07 20:45:12 +01:00
2023-10-27 18:04:29 +08:00
2023-12-14 21:54:45 -08:00
2023-11-02 19:38:47 -10:00
2023-11-03 18:56:51 -10:00
2023-11-02 20:53:31 -10:00
2023-10-30 19:09:55 -10:00
2023-11-05 21:15:17 +09:00
2023-11-16 07:39:37 -05:00
2023-11-03 14:51:08 -10:00
2023-11-09 13:47:52 -08:00
2023-11-17 13:58:26 -08:00
2023-10-27 13:19:04 +02:00
2023-11-03 14:51:08 -10:00
2023-10-31 18:32:51 -10:00
2023-11-03 15:44:25 -10:00
2023-10-31 17:44:17 -10:00
2023-11-13 12:43:42 -05:00
2023-11-04 16:25:36 -10:00
2023-11-03 14:51:08 -10:00
2023-11-02 15:20:30 -10:00
2023-11-09 14:18:42 -08:00
2023-11-09 13:37:28 -08:00
2023-11-19 13:49:32 -08:00
2023-10-30 19:09:55 -10:00
2023-11-09 13:47:52 -08:00
2023-11-03 10:07:39 -10:00
2023-11-05 18:45:32 -08:00
2023-10-21 23:04:02 +02:00
2023-11-17 14:41:15 -05:00
2023-11-06 15:06:06 -08:00
2023-11-09 13:37:28 -08:00
2023-10-24 22:36:39 -04:00
2023-11-02 14:40:51 -10:00
2023-11-08 09:21:18 -08:00
2023-11-07 13:08:12 +01:00
2023-11-10 09:19:46 -08:00
2023-11-16 07:51:26 -05:00
2023-11-08 08:07:08 -08:00
2023-11-03 14:51:08 -10:00
2023-11-10 09:23:17 -08:00
2023-11-18 18:59:30 +01:00
2023-11-10 08:41:23 +01:00
2023-11-04 16:20:36 -10:00
2023-11-07 16:40:42 -08:00
2023-11-10 12:22:14 -08:00
2023-11-03 19:06:12 -10:00
2023-11-04 10:23:23 +01:00
2023-11-04 08:46:37 -10:00
2023-11-01 14:46:51 -10:00
2023-11-03 16:00:42 -10:00
2023-10-24 22:07:07 +02:00
2023-11-13 20:51:37 -08:00
2023-11-10 09:20:48 +01:00
2023-10-30 13:14:27 +00:00
2023-10-24 14:10:04 -07:00
2023-10-23 13:11:07 -06:00
2023-11-05 18:49:40 -08:00
2023-11-09 17:09:35 -08:00
2023-11-14 11:40:40 -05:00
2023-10-25 16:50:11 +02:00
2023-11-03 10:07:39 -10:00
2023-11-03 19:10:41 -10:00
2023-11-10 11:44:38 -08:00
2023-11-01 10:02:18 +00:00
2023-11-09 13:47:52 -08:00
2023-11-02 15:13:50 -10:00
2023-10-31 15:28:37 -10:00
2023-11-03 16:00:42 -10:00
2023-11-10 09:19:46 -08:00
2023-11-14 11:40:40 -05:00
2023-11-03 16:00:42 -10:00
2023-11-01 09:31:16 -04:00
2023-11-03 14:51:08 -10:00
2023-11-16 07:39:37 -05:00
2023-11-10 09:16:02 +01:00
2023-11-04 15:58:13 -10:00
2023-11-16 07:39:37 -05:00
2023-10-21 19:19:06 +02:00
2023-11-10 09:19:46 -08:00
2023-11-15 09:51:51 +01:00
2023-11-10 09:19:46 -08:00
2023-11-10 09:19:46 -08:00