From: Greg Kroah-Hartman Date: Mon, 6 Jun 2022 14:48:23 +0000 (+0200) Subject: drop some bfq patches from 4.14 and 4.19 X-Git-Tag: v5.10.121~79 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=738087bd13e4d862b27b5fbffdca44b7ba9b6f63;p=thirdparty%2Fkernel%2Fstable-queue.git drop some bfq patches from 4.14 and 4.19 --- diff --git a/queue-4.14/bfq-track-whether-bfq_group-is-still-online.patch b/queue-4.14/bfq-track-whether-bfq_group-is-still-online.patch deleted file mode 100644 index 26fac347b1e..00000000000 --- a/queue-4.14/bfq-track-whether-bfq_group-is-still-online.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 09f871868080c33992cd6a9b72a5ca49582578fa Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Fri, 1 Apr 2022 12:27:48 +0200 -Subject: bfq: Track whether bfq_group is still online - -From: Jan Kara - -commit 09f871868080c33992cd6a9b72a5ca49582578fa upstream. - -Track whether bfq_group is still online. We cannot rely on -blkcg_gq->online because that gets cleared only after all policies are -offlined and we need something that gets updated already under -bfqd->lock when we are cleaning up our bfq_group to be able to guarantee -that when we see online bfq_group, it will stay online while we are -holding bfqd->lock lock. - -CC: stable@vger.kernel.org -Tested-by: "yukuai (C)" -Signed-off-by: Jan Kara -Reviewed-by: Christoph Hellwig -Link: https://lore.kernel.org/r/20220401102752.8599-7-jack@suse.cz -Signed-off-by: Jens Axboe -Signed-off-by: Greg Kroah-Hartman ---- - block/bfq-cgroup.c | 3 ++- - block/bfq-iosched.h | 2 ++ - 2 files changed, 4 insertions(+), 1 deletion(-) - ---- a/block/bfq-cgroup.c -+++ b/block/bfq-cgroup.c -@@ -442,6 +442,7 @@ static void bfq_pd_init(struct blkg_poli - */ - bfqg->bfqd = bfqd; - bfqg->active_entities = 0; -+ bfqg->online = true; - bfqg->rq_pos_tree = RB_ROOT; - } - -@@ -488,7 +489,6 @@ struct bfq_group *bfq_find_set_group(str - struct bfq_entity *entity; - - bfqg = bfq_lookup_bfqg(bfqd, blkcg); -- - if (unlikely(!bfqg)) - return NULL; - -@@ -788,6 +788,7 @@ static void bfq_pd_offline(struct blkg_p - - put_async_queues: - bfq_put_async_queues(bfqd, bfqg); -+ bfqg->online = false; - - spin_unlock_irqrestore(&bfqd->lock, flags); - /* ---- a/block/bfq-iosched.h -+++ b/block/bfq-iosched.h -@@ -776,6 +776,8 @@ struct bfq_group { - - /* reference counter (see comments in bfq_bic_update_cgroup) */ - int ref; -+ /* Is bfq_group still online? */ -+ bool online; - - struct bfq_entity entity; - struct bfq_sched_data sched_data; diff --git a/queue-4.14/bfq-update-cgroup-information-before-merging-bio.patch b/queue-4.14/bfq-update-cgroup-information-before-merging-bio.patch deleted file mode 100644 index 2bd76f94723..00000000000 --- a/queue-4.14/bfq-update-cgroup-information-before-merging-bio.patch +++ /dev/null @@ -1,51 +0,0 @@ -From ea591cd4eb270393810e7be01feb8fde6a34fbbe Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Fri, 1 Apr 2022 12:27:45 +0200 -Subject: bfq: Update cgroup information before merging bio - -From: Jan Kara - -commit ea591cd4eb270393810e7be01feb8fde6a34fbbe upstream. - -When the process is migrated to a different cgroup (or in case of -writeback just starts submitting bios associated with a different -cgroup) bfq_merge_bio() can operate with stale cgroup information in -bic. Thus the bio can be merged to a request from a different cgroup or -it can result in merging of bfqqs for different cgroups or bfqqs of -already dead cgroups and causing possible use-after-free issues. Fix the -problem by updating cgroup information in bfq_merge_bio(). - -CC: stable@vger.kernel.org -Fixes: e21b7a0b9887 ("block, bfq: add full hierarchical scheduling and cgroups support") -Tested-by: "yukuai (C)" -Signed-off-by: Jan Kara -Reviewed-by: Christoph Hellwig -Link: https://lore.kernel.org/r/20220401102752.8599-4-jack@suse.cz -Signed-off-by: Jens Axboe -Signed-off-by: Greg Kroah-Hartman ---- - block/bfq-iosched.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - ---- a/block/bfq-iosched.c -+++ b/block/bfq-iosched.c -@@ -1638,10 +1638,17 @@ static bool bfq_bio_merge(struct blk_mq_ - - spin_lock_irq(&bfqd->lock); - -- if (bic) -+ if (bic) { -+ /* -+ * Make sure cgroup info is uptodate for current process before -+ * considering the merge. -+ */ -+ bfq_bic_update_cgroup(bic, bio); -+ - bfqd->bio_bfqq = bic_to_bfqq(bic, op_is_sync(bio->bi_opf)); -- else -+ } else { - bfqd->bio_bfqq = NULL; -+ } - bfqd->bio_bic = bic; - - ret = blk_mq_sched_try_merge(q, bio, &free); diff --git a/queue-4.14/series b/queue-4.14/series index 1a336c86096..f912db11be5 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -103,8 +103,6 @@ perf-jevents-fix-event-syntax-error-caused-by-extsel.patch wifi-mac80211-fix-use-after-free-in-chanctx-code.patch iwlwifi-mvm-fix-assert-1f04-upon-reconfig.patch fs-writeback-writeback_sb_inodes-recalculate-wrote-according-skipped-pages.patch -bfq-update-cgroup-information-before-merging-bio.patch -bfq-track-whether-bfq_group-is-still-online.patch ext4-fix-use-after-free-in-ext4_rename_dir_prepare.patch ext4-fix-bug_on-in-ext4_writepages.patch ext4-verify-dir-block-before-splitting-it.patch diff --git a/queue-4.19/bfq-track-whether-bfq_group-is-still-online.patch b/queue-4.19/bfq-track-whether-bfq_group-is-still-online.patch deleted file mode 100644 index a455e2eb553..00000000000 --- a/queue-4.19/bfq-track-whether-bfq_group-is-still-online.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 09f871868080c33992cd6a9b72a5ca49582578fa Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Fri, 1 Apr 2022 12:27:48 +0200 -Subject: bfq: Track whether bfq_group is still online - -From: Jan Kara - -commit 09f871868080c33992cd6a9b72a5ca49582578fa upstream. - -Track whether bfq_group is still online. We cannot rely on -blkcg_gq->online because that gets cleared only after all policies are -offlined and we need something that gets updated already under -bfqd->lock when we are cleaning up our bfq_group to be able to guarantee -that when we see online bfq_group, it will stay online while we are -holding bfqd->lock lock. - -CC: stable@vger.kernel.org -Tested-by: "yukuai (C)" -Signed-off-by: Jan Kara -Reviewed-by: Christoph Hellwig -Link: https://lore.kernel.org/r/20220401102752.8599-7-jack@suse.cz -Signed-off-by: Jens Axboe -Signed-off-by: Greg Kroah-Hartman ---- - block/bfq-cgroup.c | 3 ++- - block/bfq-iosched.h | 2 ++ - 2 files changed, 4 insertions(+), 1 deletion(-) - ---- a/block/bfq-cgroup.c -+++ b/block/bfq-cgroup.c -@@ -468,6 +468,7 @@ static void bfq_pd_init(struct blkg_poli - */ - bfqg->bfqd = bfqd; - bfqg->active_entities = 0; -+ bfqg->online = true; - bfqg->rq_pos_tree = RB_ROOT; - } - -@@ -514,7 +515,6 @@ struct bfq_group *bfq_find_set_group(str - struct bfq_entity *entity; - - bfqg = bfq_lookup_bfqg(bfqd, blkcg); -- - if (unlikely(!bfqg)) - return NULL; - -@@ -814,6 +814,7 @@ static void bfq_pd_offline(struct blkg_p - - put_async_queues: - bfq_put_async_queues(bfqd, bfqg); -+ bfqg->online = false; - - spin_unlock_irqrestore(&bfqd->lock, flags); - /* ---- a/block/bfq-iosched.h -+++ b/block/bfq-iosched.h -@@ -854,6 +854,8 @@ struct bfq_group { - - /* reference counter (see comments in bfq_bic_update_cgroup) */ - int ref; -+ /* Is bfq_group still online? */ -+ bool online; - - struct bfq_entity entity; - struct bfq_sched_data sched_data; diff --git a/queue-4.19/bfq-update-cgroup-information-before-merging-bio.patch b/queue-4.19/bfq-update-cgroup-information-before-merging-bio.patch deleted file mode 100644 index 3633bae9b12..00000000000 --- a/queue-4.19/bfq-update-cgroup-information-before-merging-bio.patch +++ /dev/null @@ -1,51 +0,0 @@ -From ea591cd4eb270393810e7be01feb8fde6a34fbbe Mon Sep 17 00:00:00 2001 -From: Jan Kara -Date: Fri, 1 Apr 2022 12:27:45 +0200 -Subject: bfq: Update cgroup information before merging bio - -From: Jan Kara - -commit ea591cd4eb270393810e7be01feb8fde6a34fbbe upstream. - -When the process is migrated to a different cgroup (or in case of -writeback just starts submitting bios associated with a different -cgroup) bfq_merge_bio() can operate with stale cgroup information in -bic. Thus the bio can be merged to a request from a different cgroup or -it can result in merging of bfqqs for different cgroups or bfqqs of -already dead cgroups and causing possible use-after-free issues. Fix the -problem by updating cgroup information in bfq_merge_bio(). - -CC: stable@vger.kernel.org -Fixes: e21b7a0b9887 ("block, bfq: add full hierarchical scheduling and cgroups support") -Tested-by: "yukuai (C)" -Signed-off-by: Jan Kara -Reviewed-by: Christoph Hellwig -Link: https://lore.kernel.org/r/20220401102752.8599-4-jack@suse.cz -Signed-off-by: Jens Axboe -Signed-off-by: Greg Kroah-Hartman ---- - block/bfq-iosched.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - ---- a/block/bfq-iosched.c -+++ b/block/bfq-iosched.c -@@ -1864,10 +1864,17 @@ static bool bfq_bio_merge(struct blk_mq_ - - spin_lock_irq(&bfqd->lock); - -- if (bic) -+ if (bic) { -+ /* -+ * Make sure cgroup info is uptodate for current process before -+ * considering the merge. -+ */ -+ bfq_bic_update_cgroup(bic, bio); -+ - bfqd->bio_bfqq = bic_to_bfqq(bic, op_is_sync(bio->bi_opf)); -- else -+ } else { - bfqd->bio_bfqq = NULL; -+ } - bfqd->bio_bic = bic; - - ret = blk_mq_sched_try_merge(q, bio, &free); diff --git a/queue-4.19/series b/queue-4.19/series index 2d4bd8d3b4a..054a397477a 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -144,8 +144,6 @@ f2fs-fix-deadloop-in-foreground-gc.patch wifi-mac80211-fix-use-after-free-in-chanctx-code.patch iwlwifi-mvm-fix-assert-1f04-upon-reconfig.patch fs-writeback-writeback_sb_inodes-recalculate-wrote-according-skipped-pages.patch -bfq-update-cgroup-information-before-merging-bio.patch -bfq-track-whether-bfq_group-is-still-online.patch netfilter-nf_tables-disallow-non-stateful-expression-in-sets-earlier.patch ext4-fix-use-after-free-in-ext4_rename_dir_prepare.patch ext4-fix-bug_on-in-ext4_writepages.patch