]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
nbd: Aovid double completion of a request
authorXie Yongji <xieyongji@bytedance.com>
Fri, 13 Aug 2021 15:13:30 +0000 (23:13 +0800)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 24 Sep 2021 09:57:17 +0000 (11:57 +0200)
commit6bc5cc7c9eb0903e4117ffbd1cfc41ecd65b76f7
tree1078445dede5d6200bf086e7dc272e1000c3a51d
parent3ee39dca26c62801c0303100f3c6e55a0205a7a6
nbd: Aovid double completion of a request

BugLink: https://bugs.launchpad.net/bugs/1943756
[ Upstream commit cddce01160582a5f52ada3da9626c052d852ec42 ]

There is a race between iterating over requests in
nbd_clear_que() and completing requests in recv_work(),
which can lead to double completion of a request.

To fix it, flush the recv worker before iterating over
the requests and don't abort the completed request
while iterating.

Fixes: 96d97e17828f ("nbd: clear_sock on netlink disconnect")
Reported-by: Jiang Yadong <jiangyadong@bytedance.com>
Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Link: https://lore.kernel.org/r/20210813151330.96-1-xieyongji@bytedance.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/block/nbd.c