* [bug report] iommu/vt-d: Allocate/register iopf queue for sva devices
@ 2021-06-18 6:55 Dan Carpenter
2021-06-18 7:30 ` Lu Baolu
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-06-18 6:55 UTC (permalink / raw)
To: baolu.lu; +Cc: iommu
Hello Lu Baolu,
This is a semi-automatic email about new static checker warnings.
The patch 4c82b88696ac: "iommu/vt-d: Allocate/register iopf queue for
sva devices" from Jun 10, 2021, leads to the following Smatch
complaint:
drivers/iommu/intel/iommu.c:5335 intel_iommu_enable_sva()
warn: variable dereferenced before check 'info' (see line 5332)
drivers/iommu/intel/iommu.c
5331 struct device_domain_info *info = get_domain_info(dev);
5332 struct intel_iommu *iommu = info->iommu;
^^^^^^^^^^^
Dereferenced
5333 int ret;
5334
5335 if (!info || !iommu || dmar_disabled)
^^^^^
Checked too late. <dramatic prairie dog.gif>
5336 return -EINVAL;
5337
regards,
dan carpenter
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [bug report] iommu/vt-d: Allocate/register iopf queue for sva devices
2021-06-18 6:55 [bug report] iommu/vt-d: Allocate/register iopf queue for sva devices Dan Carpenter
@ 2021-06-18 7:30 ` Lu Baolu
0 siblings, 0 replies; 2+ messages in thread
From: Lu Baolu @ 2021-06-18 7:30 UTC (permalink / raw)
To: Dan Carpenter; +Cc: iommu
Thanks for letting me know this. We already have a fix in linux-next.
commit 90141a0fb72340937ed9ec05301cc548901d8eec
Author: Colin Ian King <colin.king@canonical.com>
Date: Fri Jun 11 14:50:24 2021 +0100
iommu/vt-d: Fix dereference of pointer info before it is null checked
The assignment of iommu from info->iommu occurs before info is null
checked
hence leading to a potential null pointer dereference issue. Fix
this by
assigning iommu and checking if iommu is null after null checking info.
Fixes: 4c82b88696ac ("iommu/vt-d: Allocate/register iopf queue for
sva devices")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Addresses-Coverity: ("Dereference before null check")
Link:
https://lore.kernel.org/r/20210611135024.32781-1-colin.king@canonical.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Best regards,
baolu
On 2021/6/18 14:55, Dan Carpenter wrote:
> Hello Lu Baolu,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 4c82b88696ac: "iommu/vt-d: Allocate/register iopf queue for
> sva devices" from Jun 10, 2021, leads to the following Smatch
> complaint:
>
> drivers/iommu/intel/iommu.c:5335 intel_iommu_enable_sva()
> warn: variable dereferenced before check 'info' (see line 5332)
>
> drivers/iommu/intel/iommu.c
> 5331 struct device_domain_info *info = get_domain_info(dev);
> 5332 struct intel_iommu *iommu = info->iommu;
> ^^^^^^^^^^^
> Dereferenced
>
> 5333 int ret;
> 5334
> 5335 if (!info || !iommu || dmar_disabled)
> ^^^^^
> Checked too late. <dramatic prairie dog.gif>
>
>
> 5336 return -EINVAL;
> 5337
>
> regards,
> dan carpenter
>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-18 7:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-18 6:55 [bug report] iommu/vt-d: Allocate/register iopf queue for sva devices Dan Carpenter
2021-06-18 7:30 ` Lu Baolu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox