Skip to content

Commit 4e5973d

Browse files
tititiou36joergroedel
authored andcommitted
iommu/vt-d: Fix an unbalanced rcu_read_lock/rcu_read_unlock()
If we return -EOPNOTSUPP, the rcu lock remains lock. This is spurious. Go through the end of the function instead. This way, the missing 'rcu_read_unlock()' is called. Fixes: 7afd7f6 ("iommu/vt-d: Check FL and SL capability sanity in scalable mode") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/40cc077ca5f543614eab2a10e84d29dd190273f6.1636217517.git.christophe.jaillet@wanadoo.fr Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Link: https://lore.kernel.org/r/20211126135556.397932-2-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent f7ff3cf commit 4e5973d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/iommu/intel/cap_audit.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ static int cap_audit_static(struct intel_iommu *iommu, enum cap_audit_type type)
144144
{
145145
struct dmar_drhd_unit *d;
146146
struct intel_iommu *i;
147+
int rc = 0;
147148

148149
rcu_read_lock();
149150
if (list_empty(&dmar_drhd_units))
@@ -169,11 +170,11 @@ static int cap_audit_static(struct intel_iommu *iommu, enum cap_audit_type type)
169170
*/
170171
if (intel_cap_smts_sanity() &&
171172
!intel_cap_flts_sanity() && !intel_cap_slts_sanity())
172-
return -EOPNOTSUPP;
173+
rc = -EOPNOTSUPP;
173174

174175
out:
175176
rcu_read_unlock();
176-
return 0;
177+
return rc;
177178
}
178179

179180
int intel_cap_audit(enum cap_audit_type type, struct intel_iommu *iommu)

0 commit comments

Comments
 (0)