提交 37c58d6e 编写于 作者: B Bodo Stroesser 提交者: Zheng Zengkai

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

stable inclusion
from stable-5.10.39
commit d47d0d1a1fb2cddbc322a7ff19ccfc127cb561c5
bugzilla: 51881
CVE: NA

--------------------------------

[ Upstream commit 9814b55c ]

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.comSigned-off-by: NBodo Stroesser <bostroesser@gmail.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 aa3b357f
...@@ -1391,7 +1391,7 @@ static int tcmu_run_tmr_queue(struct tcmu_dev *udev) ...@@ -1391,7 +1391,7 @@ static int tcmu_run_tmr_queue(struct tcmu_dev *udev)
return 1; 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_mailbox *mb;
struct tcmu_cmd *cmd; struct tcmu_cmd *cmd;
...@@ -1434,7 +1434,7 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev) ...@@ -1434,7 +1434,7 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev)
pr_err("cmd_id %u not found, ring is broken\n", pr_err("cmd_id %u not found, ring is broken\n",
entry->hdr.cmd_id); entry->hdr.cmd_id);
set_bit(TCMU_DEV_BIT_BROKEN, &udev->flags); set_bit(TCMU_DEV_BIT_BROKEN, &udev->flags);
break; return false;
} }
tcmu_handle_completion(cmd, entry); tcmu_handle_completion(cmd, entry);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册