Skip to contentSkip to conversation

rapidio-tsi721-prevent-a-bad-dereference-in-tsi721_db_dpc.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message May 29

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: rapidio/tsi721: prevent a bad dereference in tsi721_db_dpc()
has been removed from the -mm tree. Its filename was

     rapidio-tsi721-prevent-a-bad-dereference-in-tsi721_db_dpc.patch

This patch was dropped because it was merged into the mm-nonmm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Dan Carpenter <[email protected]>
Subject: rapidio/tsi721: prevent a bad dereference in tsi721_db_dpc()
Date: Fri, 8 May 2026 10:51:56 +0300

With a list_for_each() loop, if we don't find the item we are looking for in the list, then the loop exits with the iterator, which is "dbell" in this loop, pointing to invalid memory.

This code uses the "found" variable to determine if we have found the doorbell we are looking for or not. However, the problem that the "found" variable needs to be set to false at the start of each iteration, otherwise after the first correct doorbell, then everything is marked as found.

Reset the "found" to false at the start of the iteration and move the variable inside the loop.

Fixes 48618fb4e522 ("RapidIO: add mport driver for Tsi721 bridge")
Cc Alexandre Bounine <[email protected]>
Cc Chul Kim <[email protected]>
Cc Matt Porter <[email protected]>

---

 drivers/rapidio/devices/tsi721.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/rapidio/devices/tsi721.c renamed from drivers/rapidio/devices/tsi721.c~rapidio-tsi721-prevent-a-bad-dereference-in-tsi721_db_dpc +2 -1
@@ -394,7 +394,6 @@ static void tsi721_db_dpc(struct work_st
 						    idb_work);
 	struct rio_mport *mport;
 	struct rio_dbell *dbell;
-	int found = 0;
 	u32 wr_ptr, rd_ptr;
 	u64 *idb_entry;
 	u32 regval;
@@ -412,6 +411,8 @@ static void tsi721_db_dpc(struct work_st
 	rd_ptr = ioread32(priv->regs + TSI721_IDQ_RP(IDB_QUEUE)) % IDB_QSIZE;
 
 	while (wr_ptr != rd_ptr) {
+		int found = 0;
+
 		idb_entry = (u64 *)(priv->idb_base +
 					(TSI721_IDB_ENTRY_SIZE * rd_ptr));
 		rd_ptr++;

_

Patches currently in -mm which might be from [email protected] are