Qian Cai
c74ead4597
vfio/pci: fix memory leaks in alloc_perm_bits()
[ Upstream commit 3e63b94b62 ]
vfio_pci_disable() calls vfio_config_free() but forgets to call
free_perm_bits() resulting in memory leaks,
unreferenced object 0xc000000c4db2dee0 (size 16):
comm "qemu-kvm", pid 4305, jiffies 4295020272 (age 3463.780s)
hex dump (first 16 bytes):
00 00 ff 00 ff ff ff ff ff ff ff ff ff ff 00 00 ................
backtrace:
[<00000000a6a4552d>] alloc_perm_bits+0x58/0xe0 [vfio_pci]
[<00000000ac990549>] vfio_config_init+0xdf0/0x11b0 [vfio_pci]
init_pci_cap_msi_perm at drivers/vfio/pci/vfio_pci_config.c:1125
(inlined by) vfio_msi_cap_len at drivers/vfio/pci/vfio_pci_config.c:1180
(inlined by) vfio_cap_len at drivers/vfio/pci/vfio_pci_config.c:1241
(inlined by) vfio_cap_init at drivers/vfio/pci/vfio_pci_config.c:1468
(inlined by) vfio_config_init at drivers/vfio/pci/vfio_pci_config.c:1707
[<000000006db873a1>] vfio_pci_open+0x234/0x700 [vfio_pci]
[<00000000630e1906>] vfio_group_fops_unl_ioctl+0x8e0/0xb84 [vfio]
[<000000009e34c54f>] ksys_ioctl+0xd8/0x130
[<000000006577923d>] sys_ioctl+0x28/0x40
[<000000006d7b1cf2>] system_call_exception+0x114/0x1e0
[<0000000008ea7dd5>] system_call_common+0xf0/0x278
unreferenced object 0xc000000c4db2e330 (size 16):
comm "qemu-kvm", pid 4305, jiffies 4295020272 (age 3463.780s)
hex dump (first 16 bytes):
00 ff ff 00 ff ff ff ff ff ff ff ff ff ff 00 00 ................
backtrace:
[<000000004c71914f>] alloc_perm_bits+0x44/0xe0 [vfio_pci]
[<00000000ac990549>] vfio_config_init+0xdf0/0x11b0 [vfio_pci]
[<000000006db873a1>] vfio_pci_open+0x234/0x700 [vfio_pci]
[<00000000630e1906>] vfio_group_fops_unl_ioctl+0x8e0/0xb84 [vfio]
[<000000009e34c54f>] ksys_ioctl+0xd8/0x130
[<000000006577923d>] sys_ioctl+0x28/0x40
[<000000006d7b1cf2>] system_call_exception+0x114/0x1e0
[<0000000008ea7dd5>] system_call_common+0xf0/0x278
Fixes: 89e1f7d4c6 ("vfio: Add PCI device driver")
Signed-off-by: Qian Cai <cai@lca.pw>
[aw: rolled in follow-up patch]
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-06-24 17:50:15 +02:00
..
2020-06-22 09:30:54 +02:00
2019-10-23 06:26:33 -04:00
2020-03-25 08:25:50 +01:00
2020-04-17 10:50:22 +02:00
2020-02-24 08:36:36 +01:00
2019-09-17 16:22:26 -07:00
2020-06-10 20:24:57 +02:00
2019-09-13 16:44:49 +03:00
2020-06-24 17:50:15 +02:00
2020-06-22 09:31:18 +02:00
2020-04-17 10:49:56 +02:00
2020-01-04 19:18:25 +01:00
2020-06-17 16:40:36 +02:00
2020-06-24 17:50:14 +02:00
2020-06-22 09:30:55 +02:00
2020-05-02 08:48:44 +02:00
2020-06-17 16:40:33 +02:00
2020-06-22 09:31:10 +02:00
2020-06-22 09:31:07 +02:00
2020-05-27 17:46:48 +02:00
2020-05-10 10:31:34 +02:00
2020-05-27 17:46:43 +02:00
2020-05-06 08:15:01 +02:00
2020-06-22 09:31:20 +02:00
2020-04-08 09:08:43 +02:00
2020-01-09 10:20:06 +01:00
2020-06-22 09:30:52 +02:00
2020-04-29 16:33:22 +02:00
2019-12-31 16:45:09 +01:00
2020-06-22 09:31:20 +02:00
2020-06-03 08:21:28 +02:00
2020-06-22 09:31:08 +02:00
2019-08-27 19:03:08 +02:00
2020-06-07 13:18:47 +02:00
2019-09-22 12:02:21 -07:00
2020-06-22 09:31:00 +02:00
2020-06-22 09:31:19 +02:00
2020-03-25 08:25:56 +01:00
2020-06-24 17:50:12 +02:00
2019-08-27 09:43:59 +02:00
2020-02-24 08:36:53 +01:00
2019-08-28 11:29:32 +02:00
2020-06-24 17:50:12 +02:00
2020-06-17 16:40:22 +02:00
2020-06-24 17:50:12 +02:00
2019-12-17 19:55:39 +01:00
2020-06-03 08:21:28 +02:00
2020-05-27 17:46:47 +02:00
2020-04-23 10:36:20 +02:00
2019-10-28 13:33:41 -07:00
2020-04-23 10:36:37 +02:00
2019-09-05 13:17:01 -06:00
2020-06-22 09:31:22 +02:00
2020-01-04 19:18:30 +01:00
2020-06-24 17:50:13 +02:00
2020-06-22 09:31:19 +02:00
2020-01-17 19:48:59 +01:00
2019-10-09 11:08:03 +02:00
2020-01-23 08:22:35 +01:00
2020-05-10 10:31:30 +02:00
2020-06-24 17:50:13 +02:00
2020-06-22 09:31:10 +02:00
2020-06-22 09:31:26 +02:00
2020-06-22 09:31:19 +02:00
2020-06-10 20:24:54 +02:00
2019-09-23 17:20:40 -04:00
2020-04-23 10:36:42 +02:00
2020-06-22 09:31:04 +02:00
2020-06-10 20:24:57 +02:00
2020-04-23 10:36:23 +02:00
2020-02-24 08:36:34 +01:00
2019-10-14 21:44:26 +02:00
2019-12-31 16:45:25 +01:00
2020-06-24 17:50:15 +02:00
2019-09-28 08:14:15 -07:00
2020-06-22 09:31:01 +02:00
2020-04-23 10:36:33 +02:00
2020-06-24 17:50:14 +02:00
2020-06-22 09:31:11 +02:00
2020-06-24 17:50:08 +02:00
2020-01-14 20:08:18 +01:00
2020-01-23 08:22:51 +01:00
2020-04-29 16:33:02 +02:00
2020-05-27 17:46:48 +02:00
2020-06-22 09:30:58 +02:00
2020-06-24 17:50:13 +02:00
2020-02-24 08:36:41 +01:00
2020-01-14 20:08:37 +01:00
2020-06-24 17:50:12 +02:00
2020-05-20 08:20:26 +02:00
2020-06-24 17:50:12 +02:00
2020-06-22 09:31:22 +02:00
2019-12-31 16:45:11 +01:00
2020-06-22 09:31:10 +02:00
2020-02-19 19:53:07 +01:00
2019-09-13 17:23:18 +03:00
2020-06-22 09:31:18 +02:00
2020-05-27 17:46:40 +02:00
2020-02-05 21:22:49 +00:00
2020-03-05 16:43:50 +01:00
2020-02-28 17:22:13 +01:00
2020-06-24 17:50:13 +02:00
2020-02-24 08:36:27 +01:00
2020-06-24 17:50:13 +02:00
2020-06-24 17:50:15 +02:00
2020-05-27 17:46:31 +02:00
2020-06-24 17:50:09 +02:00
2019-10-10 14:50:32 +02:00
2020-03-18 07:17:55 +01:00
2020-02-24 08:36:47 +01:00
2020-02-24 08:36:48 +01:00
2020-06-22 09:31:26 +02:00
2020-06-17 16:40:27 +02:00
2020-06-17 16:40:38 +02:00
2019-09-18 11:05:34 -07:00
2019-09-18 11:05:34 -07:00