Skip to content

Commit

Permalink
scsi: target: tcmu: Return from tcmu_handle_completions() if cmd_id n…
Browse files Browse the repository at this point in the history
…ot 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. 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>
  • Loading branch information
Bodo Stroesser authored and Martin K. Petersen committed Apr 29, 2021
1 parent 2f11371 commit 9814b55
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/target/target_core_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9814b55

Please sign in to comment.