Commit e5c39ae5 authored by Yu Kuai's avatar Yu Kuai Committed by Jhih-Chen Huang (xWF)
Browse files

UPSTREAM: block, bfq: fix uaf for accessing waker_bfqq after splitting



[ Upstream commit 1ba0403a ]

After commit 42c306ed ("block, bfq: don't break merge chain in
bfq_split_bfqq()"), if the current procress is the last holder of bfqq,
the bfqq can be freed after bfq_split_bfqq(). Hence recored the bfqq and
then access bfqq->waker_bfqq may trigger UAF. What's more, the waker_bfqq
may in the merge chain of bfqq, hence just recored waker_bfqq is still
not safe.

Fix the problem by adding a helper bfq_waker_bfqq() to check if
bfqq->waker_bfqq is in the merge chain, and current procress is the only
holder.

Fixes: 42c306ed ("block, bfq: don't break merge chain in bfq_split_bfqq()")

Bug: 377605240

Change-Id: If13a4aeb3f6e66f91b5c1448960c40c0d2064a7d
Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20240909134154.954924-2-yukuai1@huaweicloud.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
(cherry picked from commit 0780451f)
parent 0cc03139
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment