projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
07175cb
)
nbd: check sock index in nbd_read_stat()
author
Yu Kuai
<yukuai3@huawei.com>
Thu, 16 Sep 2021 09:33:46 +0000
(17:33 +0800)
committer
Jens Axboe
<axboe@kernel.dk>
Mon, 18 Oct 2021 20:50:37 +0000
(14:50 -0600)
The sock that clent send request in nbd_send_cmd() and receive reply
in nbd_read_stat() should be the same.
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Link:
https://lore.kernel.org/r/20210916093350.1410403-4-yukuai3@huawei.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c
patch
|
blob
|
history
diff --git
a/drivers/block/nbd.c
b/drivers/block/nbd.c
index 0bb3c1e2d575510d9c66ab6e8f29530b88b403a1..49c501cf8a8b48a7758043ddebee3ec0270a4659 100644
(file)
--- a/
drivers/block/nbd.c
+++ b/
drivers/block/nbd.c
@@
-751,6
+751,10
@@
static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index)
ret = -ENOENT;
goto out;
}
+ if (cmd->index != index) {
+ dev_err(disk_to_dev(nbd->disk), "Unexpected reply %d from different sock %d (expected %d)",
+ tag, index, cmd->index);
+ }
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",
req, cmd->cmd_cookie, nbd_handle_to_cookie(handle));