Skip to content

Commit 7400fa1

Browse files
Acs, Jakubgregkh
authored andcommitted
block, bfq: fix re-introduced UAF in bic_set_bfqq()
Commit eca0025 ("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 cb1876f ("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: eca0025 ("block, bfq: split sync bfq_queues on a per-actuator basis") Signed-off-by: Jakub Acs <[email protected]> Cc: Hagar Hemdan <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 49100c0 commit 7400fa1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

block/bfq-cgroup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,8 @@ static void bfq_sync_bfqq_move(struct bfq_data *bfqd,
739739
* old cgroup.
740740
*/
741741
bfq_put_cooperator(sync_bfqq);
742-
bfq_release_process_ref(bfqd, sync_bfqq);
743742
bic_set_bfqq(bic, NULL, true, act_idx);
743+
bfq_release_process_ref(bfqd, sync_bfqq);
744744
}
745745
}
746746

0 commit comments

Comments
 (0)