]> git.baikalelectronics.ru Git - 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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Aug 2021 06:57:01 +0000 (08:57 +0200)
commitee5ed345aad74b56d8c0ce2a000748b387554eb9
tree6a60402858e824fd77a3a901475e88a17fe16641
parent58fe4e39f69afc00e894b8b71811422840847d02
nbd: Aovid double completion of a request

[ 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: 330120c21991 ("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>
drivers/block/nbd.c