Skip to content

Commit 494dbee

Browse files
YuKuai-huaweiaxboe
authored andcommitted
nbd: error out if socket index doesn't match in nbd_handle_reply()
commit fcf3d63 ("nbd: check sock index in nbd_read_stat()") just add error message when socket index doesn't match. Since the request and reply must be transmitted over the same socket, it's ok to error out in such situation. Signed-off-by: Yu Kuai <[email protected]> Reviewed-by: Josef Bacik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 579b517 commit 494dbee

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/block/nbd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,8 @@ static struct nbd_cmd *nbd_handle_reply(struct nbd_device *nbd, int index,
762762
if (cmd->index != index) {
763763
dev_err(disk_to_dev(nbd->disk), "Unexpected reply %d from different sock %d (expected %d)",
764764
tag, index, cmd->index);
765+
ret = -ENOENT;
766+
goto out;
765767
}
766768
if (cmd->cmd_cookie != nbd_handle_to_cookie(handle)) {
767769
dev_err(disk_to_dev(nbd->disk), "Double reply on req %p, cmd_cookie %u, handle cookie %u\n",

0 commit comments

Comments
 (0)