summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBodo Stroesser <bostroesser@gmail.com>2021-04-23 17:01:23 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-22 10:59:49 +0200
commit84d29b2fb3caf42d0bb0907a0ba01fa111ff4791 (patch)
tree64fe7448a50a6efc7c1fcba1dfed30fea26f1593
parent3b96a0c8684b8926a62230f919b64c18a9e583fd (diff)
downloadlinux-stable-84d29b2fb3caf42d0bb0907a0ba01fa111ff4791.tar.gz
linux-stable-84d29b2fb3caf42d0bb0907a0ba01fa111ff4791.tar.bz2
linux-stable-84d29b2fb3caf42d0bb0907a0ba01fa111ff4791.zip
scsi: target: tcmu: Return from tcmu_handle_completions() if cmd_id not found
[ Upstream commit 9814b55cde0588b6d9bc496cee43f87316cbc6f1 ] 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>
-rw-r--r--drivers/target/target_core_user.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c
index 0219b5a865be..dd7307375504 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -1216,7 +1216,7 @@ static void tcmu_set_next_deadline(struct list_head *queue,
del_timer(timer);
}
-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;
@@ -1256,7 +1256,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);