Forwarded: [PATCH] spi: core: do not WARN on allocation failure in spi_controller_id_alloc
From: syzbot
Date: Fri Oct 30 2026 - 12:40:01 EST
For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx, syzkaller-bugs@xxxxxxxxxxxxxxxx.
***
Subject: [PATCH] spi: core: do not WARN on allocation failure in spi_controller_id_alloc
Author: gowtham398gs@xxxxxxxxx
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
Signed-off-by: Gowtham S Bhushan <gowtham398gs@xxxxxxxxx>
---
drivers/spi/spi.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 40cda0037ea5..319fe204da3a 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -3631,8 +3631,17 @@ static int spi_controller_id_alloc(struct spi_controller *ctlr, int start, int e
mutex_lock(&board_lock);
id = idr_alloc(&spi_controller_idr, ctlr, start, end, GFP_KERNEL);
mutex_unlock(&board_lock);
- if (WARN(id < 0, "couldn't get idr"))
+
+ /*
+ * Modify the error handling path to only trigger a WARN when the failure
+ * is not due to an out-of-memory condition
+ */
+
+ if (id < 0) {
+ WARN(id != -ENOMEM, "couldn't get idr");
return id == -ENOSPC ? -EBUSY : id;
+ }
+
ctlr->bus_num = id;
return 0;
}
--
2.56.0