Files
android_kernel_xiaomi_sm8450/include/linux
Lu Baolu cf34f8f669 iommu: Return right value in iommu_sva_bind_device()
[ Upstream commit 89e8a2366e3bce584b6c01549d5019c5cda1205e ]

iommu_sva_bind_device() should return either a sva bond handle or an
ERR_PTR value in error cases. Existing drivers (idxd and uacce) only
check the return value with IS_ERR(). This could potentially lead to
a kernel NULL pointer dereference issue if the function returns NULL
instead of an error pointer.

In reality, this doesn't cause any problems because iommu_sva_bind_device()
only returns NULL when the kernel is not configured with CONFIG_IOMMU_SVA.
In this case, iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_SVA) will
return an error, and the device drivers won't call iommu_sva_bind_device()
at all.

Fixes: 26b25a2b98 ("iommu: Bind process address spaces to devices")
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Link: https://lore.kernel.org/r/20240528042528.71396-1-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-07-05 09:12:27 +02:00
..
2024-01-25 14:37:54 -08:00
2022-08-21 15:16:16 +02:00
2024-02-23 08:41:51 +01:00
2022-10-26 13:25:35 +02:00
2020-10-02 15:00:49 -07:00
2020-10-16 17:21:51 +02:00
2023-12-20 15:44:30 +01:00
2024-06-21 14:53:19 +02:00
2024-06-21 14:53:46 +02:00
2020-08-12 20:42:08 +02:00
2023-10-25 11:54:20 +02:00
2022-10-26 13:25:42 +02:00
2020-09-16 08:54:53 -05:00
2023-03-17 08:45:07 +01:00
2023-03-17 08:45:07 +01:00
2020-11-19 22:38:29 -05:00
2021-03-04 11:37:59 +01:00
2022-08-21 15:16:08 +02:00
2020-09-04 09:25:20 -07:00
2024-06-21 14:53:28 +02:00
2022-08-21 15:15:21 +02:00
2020-09-04 12:46:07 +01:00
2021-06-30 08:47:26 -04:00
2020-08-27 16:06:47 -04:00
2023-01-04 11:39:16 +01:00
2023-11-20 11:06:46 +01:00
2023-06-21 15:45:38 +02:00
2024-04-13 12:58:31 +02:00
2024-06-21 14:53:36 +02:00
2024-01-25 14:37:40 -08:00
2024-02-23 08:42:11 +01:00
2020-08-31 12:52:33 -07:00
2021-03-30 14:32:05 +02:00
2023-11-28 16:54:53 +00:00
2023-10-25 11:54:13 +02:00
2023-10-25 11:54:13 +02:00
2020-08-18 17:06:15 +02:00
2020-09-26 22:55:05 -04:00
2021-05-07 11:04:32 +02:00
2021-05-14 09:50:18 +02:00
2023-05-17 11:48:09 +02:00
2020-09-10 14:03:31 -07:00
2024-02-23 08:41:51 +01:00
2020-10-05 13:21:49 +02:00