aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2021-11-01 17:25:38 +0800
committerJens Axboe <axboe@kernel.dk>2021-11-02 14:42:41 -0600
commit494dbee341e7a02529ce776ee9a5e0b7733ca280 (patch)
tree1d1de12253308469e019c16760c747debf54f593 /drivers/block
parentMerge branch 'md-next' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into for-5.16/drivers (diff)
downloadlinux-dev-494dbee341e7a02529ce776ee9a5e0b7733ca280.tar.xz
linux-dev-494dbee341e7a02529ce776ee9a5e0b7733ca280.zip
nbd: error out if socket index doesn't match in nbd_handle_reply()
commit fcf3d633d8e1 ("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 <yukuai3@huawei.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Link: https://lore.kernel.org/r/20211101092538.1155842-1-yukuai3@huawei.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/nbd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 60751b185e6d..c62240883ea1 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -762,6 +762,8 @@ static struct nbd_cmd *nbd_handle_reply(struct nbd_device *nbd, int index,
if (cmd->index != index) {
dev_err(disk_to_dev(nbd->disk), "Unexpected reply %d from different sock %d (expected %d)",
tag, index, cmd->index);
+ ret = -ENOENT;
+ goto out;
}
if (cmd->cmd_cookie != nbd_handle_to_cookie(handle)) {
dev_err(disk_to_dev(nbd->disk), "Double reply on req %p, cmd_cookie %u, handle cookie %u\n",