[lvc-project] [PATCH] dmaengine: ioat: Reduce attnstatus traverse iterations to IOAT_MAX_CHANS
Nikolay Kuratov
kniv at yandex-team.ru
Wed Mar 19 12:37:52 MSK 2025
We don't need to check all BITS_PER_LONG entries, since any bit set in
position >= IOAT_MAX_CHANS would result in out-of-bounds ioat_dma->idx
access by ioat_chan_by_index().
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Nikolay Kuratov <kniv at yandex-team.ru>
Cc: lvc-project at linuxtesting.org
Cc: stable at vger.kernel.org
Fixes: 3e037454bcfa4 ("I/OAT: Add support for MSI and MSI-X")
---
drivers/dma/ioat/dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
index 79d8957f9e60..7ae6861c26aa 100644
--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -107,7 +107,7 @@ irqreturn_t ioat_dma_do_interrupt(int irq, void *data)
}
attnstatus = readl(instance->reg_base + IOAT_ATTNSTATUS_OFFSET);
- for_each_set_bit(bit, &attnstatus, BITS_PER_LONG) {
+ for_each_set_bit(bit, &attnstatus, IOAT_MAX_CHANS) {
ioat_chan = ioat_chan_by_index(instance, bit);
if (test_bit(IOAT_RUN, &ioat_chan->state))
tasklet_schedule(&ioat_chan->cleanup_task);
--
2.34.1
More information about the lvc-project
mailing list