[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZuJxQKseMZjTjqdt@iZbp1asjb3cy8ks0srf007Z>
Date: Thu, 12 Sep 2024 12:42:40 +0800
From: Qianqiang Liu <qianqiang.liu@....com>
To: suravee.suthikulpanit@....com, will@...nel.org
Cc: vasant.hegde@....com, iommu@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Should the return value of the rlookup_amd_iommu be checked?
Hi,
I reviewed the following code:
1592 void amd_iommu_update_and_flush_device_table(struct protection_domain *domain)
1593 {
1594 struct iommu_dev_data *dev_data;
1595
1596 list_for_each_entry(dev_data, &domain->dev_list, list) {
1597 struct amd_iommu *iommu = rlookup_amd_iommu(dev_data->dev); <-
1598
1599 set_dte_entry(iommu, dev_data); <-
1600 clone_aliases(iommu, dev_data->dev);
1601 }
1602
1603 list_for_each_entry(dev_data, &domain->dev_list, list)
1604 device_flush_dte(dev_data);
1605
1606 domain_flush_complete(domain);
1607 }
The "rlookup_amd_iommu" function may return NULL, and the "set_dte_entry" function
will call "get_dev_table" which will dereference the NULL pointer.
Is this an issue that may cause panic? Or will "rlookup_amd_iommu" function never
return NULL?
--
Best,
Qianqiang Liu
Powered by blists - more mailing lists