[PATCH v2 1/4] i3c: dw: Fix IBI slot leak on oversized payload
From: Sam Agazaryan
Date: Sat Dec 05 2026 - 01:56:21 EST
dw_i3c_master_handle_ibi_sir() takes a slot from the generic IBI pool
before it checks the payload length. When the payload is longer than
the device driver asked for, it drains the IBI and returns without
giving the slot back. Each such IBI leaks a slot. Once the pool is
empty, every later IBI from that device is dropped, and freeing the
IBI makes i3c_generic_ibi_free_pool() warn about the missing slots.
Return the slot to the pool before draining.
Fixes: e389b1d72a62 ("i3c: dw: Add support for in-band interrupts")
Signed-off-by: Sam Agazaryan <samagazaryan@xxxxxxxxxx>
---
Notes:
New in v2. Patch 3 frees a pool only once all its slots are back, so
without this fix the leaked slot would keep the pool allocated.
drivers/i3c/master/dw-i3c-master.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 76875301b5ce..9434d1383033 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -1486,6 +1486,7 @@ static void dw_i3c_master_handle_ibi_sir(struct dw_i3c_master *master,
dev_dbg_ratelimited(&master->base.dev,
"IBI payload len %d greater than max %d\n",
len, dev->ibi->max_payload_len);
+ i3c_generic_ibi_recycle_slot(data->ibi_pool, slot);
goto err_drain;
}
--
2.56.1.915.g69d5ec7298-goog