Commit 1ba0403
block, bfq: fix uaf for accessing waker_bfqq after splitting
After commit 42c306e ("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: 42c306e ("block, bfq: don't break merge chain in bfq_split_bfqq()")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20240909134154.954924-2-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 29390bb commit 1ba0403
1 file changed
Lines changed: 28 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6825 | 6825 | | |
6826 | 6826 | | |
6827 | 6827 | | |
| 6828 | + | |
| 6829 | + | |
| 6830 | + | |
| 6831 | + | |
| 6832 | + | |
| 6833 | + | |
| 6834 | + | |
| 6835 | + | |
| 6836 | + | |
| 6837 | + | |
| 6838 | + | |
| 6839 | + | |
| 6840 | + | |
| 6841 | + | |
| 6842 | + | |
| 6843 | + | |
| 6844 | + | |
| 6845 | + | |
| 6846 | + | |
| 6847 | + | |
| 6848 | + | |
| 6849 | + | |
| 6850 | + | |
| 6851 | + | |
| 6852 | + | |
6828 | 6853 | | |
6829 | 6854 | | |
6830 | 6855 | | |
| |||
6886 | 6911 | | |
6887 | 6912 | | |
6888 | 6913 | | |
6889 | | - | |
| 6914 | + | |
6890 | 6915 | | |
6891 | 6916 | | |
6892 | 6917 | | |
| |||
6906 | 6931 | | |
6907 | 6932 | | |
6908 | 6933 | | |
6909 | | - | |
| 6934 | + | |
6910 | 6935 | | |
6911 | 6936 | | |
6912 | 6937 | | |
| |||
6916 | 6941 | | |
6917 | 6942 | | |
6918 | 6943 | | |
6919 | | - | |
| 6944 | + | |
6920 | 6945 | | |
6921 | 6946 | | |
6922 | 6947 | | |
| |||
0 commit comments