Skip to content

Commit d47d0d1

Browse files
bostroessergregkh
authored andcommitted
scsi: target: tcmu: Return from tcmu_handle_completions() if cmd_id not found
[ Upstream commit 9814b55 ] 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. This 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. Link: https://lore.kernel.org/r/20210423150123.24468-1-bostroesser@gmail.com Signed-off-by: Bodo Stroesser <bostroesser@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 3611ce2 commit d47d0d1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/target/target_core_user.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ static int tcmu_run_tmr_queue(struct tcmu_dev *udev)
13911391
return 1;
13921392
}
13931393

1394-
static unsigned int tcmu_handle_completions(struct tcmu_dev *udev)
1394+
static bool tcmu_handle_completions(struct tcmu_dev *udev)
13951395
{
13961396
struct tcmu_mailbox *mb;
13971397
struct tcmu_cmd *cmd;
@@ -1434,7 +1434,7 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev)
14341434
pr_err("cmd_id %u not found, ring is broken\n",
14351435
entry->hdr.cmd_id);
14361436
set_bit(TCMU_DEV_BIT_BROKEN, &udev->flags);
1437-
break;
1437+
return false;
14381438
}
14391439

14401440
tcmu_handle_completion(cmd, entry);

0 commit comments

Comments
 (0)