]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
block, bfq: fix re-introduced UAF in bic_set_bfqq()
authorAcs, Jakub <acsjakub@amazon.de>
Tue, 25 Mar 2025 10:24:41 +0000 (10:24 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Mar 2025 20:59:02 +0000 (21:59 +0100)
commit7400fa1729202b3cbaf020507207e176b4a0cff2
treed2e733d75deae6940d898db4c4c3b013debded72
parent49100c0b070e900f87c8fac3be9b9ef8a30fa673
block, bfq: fix re-introduced UAF in bic_set_bfqq()

Commit eca0025faa96ac ("block, bfq: split sync bfq_queues on a
per-actuator basis"), which is a backport of 9778369a2d6c5e ("block,
bfq: split sync bfq_queues on a per-actuator basis") re-introduces UAF
bug originally fixed by b600de2d7d3a16 ("block, bfq: fix uaf for bfqq in
bic_set_bfqq()") and backported to 6.1 in cb1876fc33af26 ("block, bfq:
fix uaf for bfqq in bic_set_bfqq()").

bfq_release_process_ref() may release the sync_bfqq variable, which
points to the same bfqq as bic->bfqq member for call context from
__bfq_bic_change_cgroup(). bic_set_bfqq() then accesses bic->bfqq member
which leads to the UAF condition.

Fix this by bringing the incriminated function calls back in correct
order.

Fixes: eca0025faa96ac ("block, bfq: split sync bfq_queues on a per-actuator basis")
Signed-off-by: Jakub Acs <acsjakub@amazon.de>
Cc: Hagar Hemdan <hagarhem@amazon.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/bfq-cgroup.c