Skip to contentSkip to conversation

scsi: target: tcmu: Return from tcmu_handle_completions if cmd_id not found

PATCH Applied Bodo Stroesser 2 participants 2 messages Apr 23, 2021 – Apr 29, 2021

Subsystems (3)
lore
Share & tools
lore

Bodo Stroesser

author maintainer
#0 lore raw

PATCH 1/1 scsi: target: tcmu: Return from tcmu_handle_completions if cmd_id not found

If tcmu_handle_completions finds an invalid cmd_id while looping over cmd responses from userspace, it sets TCMU_DEV_BIT_BROKEN and breaks the loop, which means that it does further handling for the tcmu device.

Skip that handling by replacing 'break' with 'return'.

Additionally change tcmu_handle_completions from unsigned int to bool, since the value used in return already is bool.

---
 drivers/target/target_core_user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/target/target_core_user.c +2 -2
index eec2fd573e2b..198d25ae482a 100644
@@ -1413,7 +1413,7 @@ static int tcmu_run_tmr_queue(struct tcmu_dev *udev)
 	return 1;
 }
 
-static unsigned int tcmu_handle_completions(struct tcmu_dev *udev)
+static bool tcmu_handle_completions(struct tcmu_dev *udev)
 {
 	struct tcmu_mailbox *mb;
 	struct tcmu_cmd *cmd;
@@ -1456,7 +1456,7 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev)
 			pr_err("cmd_id %u not found, ring is broken\n",
 			       entry->hdr.cmd_id);
 			set_bit(TCMU_DEV_BIT_BROKEN, &udev->flags);
-			break;
+			return false;
 		}
 
 		tcmu_handle_completion(cmd, entry);
Signature · 1 line
2.12.3
#1 lore raw
Quoted 8 lines · Bodo Stroesser

If tcmu_handle_completions finds an invalid cmd_id while looping over cmd responses from userspace, it sets TCMU_DEV_BIT_BROKEN and breaks the loop, which means that it does further handling for the tcmu device.

Skip that handling by replacing 'break' with 'return'.

[...]

Applied to 5.13/scsi-fixes, thanks!

[1/1] scsi: target: tcmu: Return from tcmu_handle_completions if cmd_id not found

      https://git.kernel.org/mkp/scsi/c/9814b55cde05
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering