[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220609153843.1991-3-jvetter@kalrayinc.com>
Date: Thu, 9 Jun 2022 17:38:43 +0200
From: Julian Vetter <jvetter@...rayinc.com>
To: gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
ysionneau@...rayinc.com
Cc: Julian Vetter <jvetter@...rayinc.com>
Subject: [PATCH 2/2] msi: Add sanity check if more than MAX_DEV_MSIS MSIs are requested
If a device requests more than MAX_DEV_MSIS the MSI index will collide with
the devid and might cause Linux to compute twice the same virtual interrupt
number for two different devices.
Signed-off-by: Julian Vetter <jvetter@...rayinc.com>
Reviewed-by: Yann Sionneau <ysionneau@...rayinc.com>
---
drivers/base/platform-msi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/base/platform-msi.c b/drivers/base/platform-msi.c
index 4b0b2fe3a7ff..627d8f6b83ea 100644
--- a/drivers/base/platform-msi.c
+++ b/drivers/base/platform-msi.c
@@ -40,6 +40,8 @@ static irq_hw_number_t platform_msi_calc_hwirq(struct msi_desc *desc)
{
u32 devid = desc->dev->msi.data->platform_data->devid;
+ WARN_ON(desc->msi_index >= MAX_DEV_MSIS);
+
return (devid << (32 - DEV_ID_SHIFT)) | desc->msi_index;
}
--
2.17.1
Powered by blists - more mailing lists