Xiaotao Yin
c65eddfef6
iommu/iova: Init the struct iova to fix the possible memleak
[ Upstream commit 472d26df5e ]
During ethernet(Marvell octeontx2) set ring buffer test:
ethtool -G eth1 rx <rx ring size> tx <tx ring size>
following kmemleak will happen sometimes:
unreferenced object 0xffff000b85421340 (size 64):
comm "ethtool", pid 867, jiffies 4295323539 (age 550.500s)
hex dump (first 64 bytes):
80 13 42 85 0b 00 ff ff ff ff ff ff ff ff ff ff ..B.............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
ff ff ff ff ff ff ff ff 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:
[<000000001b204ddf>] kmem_cache_alloc+0x1b0/0x350
[<00000000d9ef2e50>] alloc_iova+0x3c/0x168
[<00000000ea30f99d>] alloc_iova_fast+0x7c/0x2d8
[<00000000b8bb2f1f>] iommu_dma_alloc_iova.isra.0+0x12c/0x138
[<000000002f1a43b5>] __iommu_dma_map+0x8c/0xf8
[<00000000ecde7899>] iommu_dma_map_page+0x98/0xf8
[<0000000082004e59>] otx2_alloc_rbuf+0xf4/0x158
[<000000002b107f6b>] otx2_rq_aura_pool_init+0x110/0x270
[<00000000c3d563c7>] otx2_open+0x15c/0x734
[<00000000a2f5f3a8>] otx2_dev_open+0x3c/0x68
[<00000000456a98b5>] otx2_set_ringparam+0x1ac/0x1d4
[<00000000f2fbb819>] dev_ethtool+0xb84/0x2028
[<0000000069b67c5a>] dev_ioctl+0x248/0x3a0
[<00000000af38663a>] sock_ioctl+0x280/0x638
[<000000002582384c>] do_vfs_ioctl+0x8b0/0xa80
[<000000004e1a2c02>] ksys_ioctl+0x84/0xb8
The reason:
When alloc_iova_mem() without initial with Zero, sometimes fpn_lo will
equal to IOVA_ANCHOR by chance, so when return with -ENOMEM(iova32_full)
from __alloc_and_insert_iova_range(), the new_iova will not be freed in
free_iova_mem().
Fixes: bb68b2fbfb ("iommu/iova: Add rbtree anchor node")
Signed-off-by: Xiaotao Yin <xiaotao.yin@windriver.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12 12:21:35 +01:00
..
2020-01-09 10:20:02 +01:00
2019-10-23 06:26:33 -04:00
2019-12-17 19:55:33 +01:00
2020-01-09 10:19:59 +01:00
2019-09-25 13:54:45 +02:00
2019-09-17 16:22:26 -07:00
2019-12-31 16:45:39 +01:00
2019-09-13 16:44:49 +03:00
2020-01-09 10:20:07 +01:00
2020-01-09 10:20:04 +01:00
2020-01-12 12:21:27 +01:00
2020-01-04 19:18:25 +01:00
2019-12-31 16:45:52 +01:00
2020-01-12 12:21:34 +01:00
2020-01-09 10:19:59 +01:00
2019-12-31 16:45:26 +01:00
2019-12-17 19:56:23 +01:00
2019-12-31 16:45:45 +01:00
2020-01-09 10:20:01 +01:00
2020-01-09 10:20:00 +01:00
2019-12-21 11:04:48 +01:00
2019-12-31 16:45:16 +01:00
2019-12-31 16:44:04 +01:00
2020-01-09 10:20:06 +01:00
2020-01-12 12:21:16 +01:00
2019-09-18 11:14:31 -07:00
2019-12-31 16:45:09 +01:00
2020-01-12 12:21:12 +01:00
2020-01-09 10:20:06 +01:00
2019-08-27 19:03:08 +02:00
2020-01-09 10:20:02 +01:00
2019-09-22 12:02:21 -07:00
2020-01-04 19:18:21 +01:00
2019-10-28 18:46:55 -07:00
2019-12-31 16:46:09 +01:00
2020-01-04 19:17:27 +01:00
2019-08-27 09:43:59 +02:00
2019-08-16 11:33:56 -07:00
2019-08-28 11:29:32 +02:00
2020-01-09 10:19:43 +01:00
2020-01-09 10:19:50 +01:00
2020-01-04 19:17:34 +01:00
2019-12-17 19:55:39 +01:00
2020-01-12 12:21:35 +01:00
2020-01-04 19:17:22 +01:00
2019-10-28 13:33:41 -07:00
2020-01-04 19:17:05 +01:00
2019-09-05 13:17:01 -06:00
2019-10-21 02:05:21 +02:00
2020-01-04 19:18:30 +01:00
2020-01-09 10:19:48 +01:00
2020-01-09 10:20:05 +01:00
2019-08-30 15:57:27 +02:00
2019-10-09 11:08:03 +02:00
2019-10-24 08:49:25 +01:00
2020-01-12 12:21:31 +01:00
2020-01-04 19:19:19 +01:00
2019-12-17 19:55:54 +01:00
2020-01-12 12:21:33 +01:00
2019-12-31 16:41:49 +01:00
2019-09-23 17:20:40 -04:00
2020-01-04 19:18:12 +01:00
2020-01-09 10:19:43 +01:00
2019-12-31 16:44:42 +01:00
2020-01-09 10:20:03 +01:00
2019-10-23 10:58:44 +05:30
2019-10-14 21:44:26 +02:00
2019-12-31 16:45:25 +01:00
2020-01-09 10:19:52 +01:00
2019-09-28 08:14:15 -07:00
2019-08-30 12:46:12 +01:00
2020-01-09 10:20:05 +01:00
2020-01-12 12:21:28 +01:00
2020-01-09 10:20:03 +01:00
2019-12-31 16:44:12 +01:00
2019-09-17 19:15:14 -07:00
2020-01-04 19:18:48 +01:00
2019-11-08 18:38:06 +01:00
2020-01-12 12:21:34 +01:00
2019-09-22 10:55:08 -07:00
2020-01-12 12:21:21 +01:00
2019-12-21 11:04:41 +01:00
2019-12-17 19:56:52 +01:00
2020-01-04 19:18:27 +01:00
2020-01-09 10:20:01 +01:00
2019-08-18 12:56:10 +02:00
2019-12-13 08:42:40 +01:00
2019-12-31 16:45:11 +01:00
2020-01-12 12:21:34 +01:00
2019-09-13 17:23:18 +03:00
2020-01-12 12:21:35 +01:00
2020-01-04 19:18:17 +01:00
2019-09-25 17:51:41 -07:00
2019-12-13 08:43:21 +01:00
2019-12-04 22:30:50 +01:00
2020-01-09 10:20:05 +01:00
2019-09-18 11:14:31 -07:00
2020-01-12 12:21:10 +01:00
2019-12-21 11:04:48 +01:00
2020-01-04 19:19:18 +01:00
2019-12-17 19:56:42 +01:00
2019-10-10 14:50:32 +02:00
2019-12-17 19:55:56 +01:00
2019-10-10 15:35:41 +02:00
2020-01-09 10:20:03 +01:00
2020-01-09 10:19:51 +01:00
2019-09-18 11:05:34 -07:00
2019-09-18 11:05:34 -07:00