Skip to content

Commit db3568f

Browse files
author
Marc Zyngier
committed
genirq/msi: Check for the presence of an irq domain when validating msi_ctrl
For architectures such as s390 and powerpc that do not use irq domains for MSIs, dev->msi.domain is always NULL, so the per-device, per-bus MSI domain is also guaranteed to be NULL. So checking one without checking the other is bound to result in a splat, followed by a memory leak as we don't free the MSI descriptors. Add the missing check. Reported-by: Matthew Rosato <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 84e57d2 commit db3568f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/irq/msi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ static bool msi_ctrl_valid(struct device *dev, struct msi_ctrl *ctrl)
165165
unsigned int hwsize;
166166

167167
if (WARN_ON_ONCE(ctrl->domid >= MSI_MAX_DEVICE_IRQDOMAINS ||
168-
!dev->msi.data->__domains[ctrl->domid].domain))
168+
(dev->msi.domain &&
169+
!dev->msi.data->__domains[ctrl->domid].domain)))
169170
return false;
170171

171172
hwsize = msi_domain_get_hwsize(dev, ctrl->domid);

0 commit comments

Comments
 (0)