Commit b8137480 authored by Yu Kuai's avatar Yu Kuai Committed by sanglipeng
Browse files

block, bfq: replace 0/1 with false/true in bic apis

stable inclusion
from stable-v5.10.175
commit 6291281f15e147428c95f0e053108086eba78f6e
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8711T

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=6291281f15e147428c95f0e053108086eba78f6e



--------------------------------

[ Upstream commit 337366e0 ]

Just to make the code a litter cleaner, there are no functional changes.

Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20221214033155.3455754-3-yukuai1@huaweicloud.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Stable-dep-of: b600de2d ("block, bfq: fix uaf for bfqq in bic_set_bfqq()")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKhazhismel Kumykov <khazhy@google.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 798135bc
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -701,15 +701,15 @@ static void *__bfq_bic_change_cgroup(struct bfq_data *bfqd,
				     struct bfq_io_cq *bic,
				     struct bfq_group *bfqg)
{
	struct bfq_queue *async_bfqq = bic_to_bfqq(bic, 0);
	struct bfq_queue *sync_bfqq = bic_to_bfqq(bic, 1);
	struct bfq_queue *async_bfqq = bic_to_bfqq(bic, false);
	struct bfq_queue *sync_bfqq = bic_to_bfqq(bic, true);
	struct bfq_entity *entity;

	if (async_bfqq) {
		entity = &async_bfqq->entity;

		if (entity->sched_data != &bfqg->sched_data) {
			bic_set_bfqq(bic, NULL, 0);
			bic_set_bfqq(bic, NULL, false);
			bfq_release_process_ref(bfqd, async_bfqq);
		}
	}
@@ -745,7 +745,7 @@ static void *__bfq_bic_change_cgroup(struct bfq_data *bfqd,
				 */
				bfq_put_cooperator(sync_bfqq);
				bfq_release_process_ref(bfqd, sync_bfqq);
				bic_set_bfqq(bic, NULL, 1);
				bic_set_bfqq(bic, NULL, true);
			}
		}
	}
+2 −2
Original line number Diff line number Diff line
@@ -2841,7 +2841,7 @@ bfq_merge_bfqqs(struct bfq_data *bfqd, struct bfq_io_cq *bic,
	/*
	 * Merge queues (that is, let bic redirect its requests to new_bfqq)
	 */
	bic_set_bfqq(bic, new_bfqq, 1);
	bic_set_bfqq(bic, new_bfqq, true);
	bfq_mark_bfqq_coop(new_bfqq);
	/*
	 * new_bfqq now belongs to at least two bics (it is a shared queue):
@@ -6013,7 +6013,7 @@ bfq_split_bfqq(struct bfq_io_cq *bic, struct bfq_queue *bfqq)
		return bfqq;
	}

	bic_set_bfqq(bic, NULL, 1);
	bic_set_bfqq(bic, NULL, true);

	bfq_put_cooperator(bfqq);