summaryrefslogtreecommitdiffstats
path: root/block/blk-cgroup-rwstat.h
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2021-05-11 23:22:34 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-14 16:55:58 +0200
commita3362ff0433b9cbd545c35baae59c5788b766e53 (patch)
tree90eedce510e877672596c1eca87165c766ae45be /block/blk-cgroup-rwstat.h
parentf58625bf2ca9d8ecdd02c8021d754a7d437c207f (diff)
downloadlinux-stable-a3362ff0433b9cbd545c35baae59c5788b766e53.tar.gz
linux-stable-a3362ff0433b9cbd545c35baae59c5788b766e53.tar.bz2
linux-stable-a3362ff0433b9cbd545c35baae59c5788b766e53.zip
blk-mq: grab rq->refcount before calling ->fn in blk_mq_tagset_busy_iter
[ Upstream commit 2e315dc07df009c3e29d6926871f62a30cfae394 ] Grab rq->refcount before calling ->fn in blk_mq_tagset_busy_iter(), and this way will prevent the request from being re-used when ->fn is running. The approach is same as what we do during handling timeout. Fix request use-after-free(UAF) related with completion race or queue releasing: - If one rq is referred before rq->q is frozen, then queue won't be frozen before the request is released during iteration. - If one rq is referred after rq->q is frozen, refcount_inc_not_zero() will return false, and we won't iterate over this request. However, still one request UAF not covered: refcount_inc_not_zero() may read one freed request, and it will be handled in next patch. Tested-by: John Garry <john.garry@huawei.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20210511152236.763464-3-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'block/blk-cgroup-rwstat.h')
0 files changed, 0 insertions, 0 deletions