From b21dd0470f8d2e23a069389168f831d7c7d2f835 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 30 Jun 2022 13:25:55 +0200 Subject: [PATCH] 5.18-stable patches added patches: bcache-memset-on-stack-variables-in-bch_btree_check-and-bch_sectors_dirty_init.patch --- ...ree_check-and-bch_sectors_dirty_init.patch | 42 +++++++++++++++++++ queue-5.18/series | 1 + 2 files changed, 43 insertions(+) create mode 100644 queue-5.18/bcache-memset-on-stack-variables-in-bch_btree_check-and-bch_sectors_dirty_init.patch diff --git a/queue-5.18/bcache-memset-on-stack-variables-in-bch_btree_check-and-bch_sectors_dirty_init.patch b/queue-5.18/bcache-memset-on-stack-variables-in-bch_btree_check-and-bch_sectors_dirty_init.patch new file mode 100644 index 00000000000..6425e519615 --- /dev/null +++ b/queue-5.18/bcache-memset-on-stack-variables-in-bch_btree_check-and-bch_sectors_dirty_init.patch @@ -0,0 +1,42 @@ +From 7d6b902ea0e02b2a25c480edf471cbaa4ebe6b3c Mon Sep 17 00:00:00 2001 +From: Coly Li +Date: Fri, 27 May 2022 23:28:16 +0800 +Subject: bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init() + +From: Coly Li + +commit 7d6b902ea0e02b2a25c480edf471cbaa4ebe6b3c upstream. + +The local variables check_state (in bch_btree_check()) and state (in +bch_sectors_dirty_init()) should be fully filled by 0, because before +allocating them on stack, they were dynamically allocated by kzalloc(). + +Signed-off-by: Coly Li +Link: https://lore.kernel.org/r/20220527152818.27545-2-colyli@suse.de +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + drivers/md/bcache/btree.c | 1 + + drivers/md/bcache/writeback.c | 1 + + 2 files changed, 2 insertions(+) + +--- a/drivers/md/bcache/btree.c ++++ b/drivers/md/bcache/btree.c +@@ -2017,6 +2017,7 @@ int bch_btree_check(struct cache_set *c) + if (c->root->level == 0) + return 0; + ++ memset(&check_state, 0, sizeof(struct btree_check_state)); + check_state.c = c; + check_state.total_threads = bch_btree_chkthread_nr(); + check_state.key_idx = 0; +--- a/drivers/md/bcache/writeback.c ++++ b/drivers/md/bcache/writeback.c +@@ -950,6 +950,7 @@ void bch_sectors_dirty_init(struct bcach + return; + } + ++ memset(&state, 0, sizeof(struct bch_dirty_init_state)); + state.c = c; + state.d = d; + state.total_threads = bch_btre_dirty_init_thread_nr(); diff --git a/queue-5.18/series b/queue-5.18/series index c11cb104239..0030134f590 100644 --- a/queue-5.18/series +++ b/queue-5.18/series @@ -1,2 +1,3 @@ tick-nohz-unexport-__init-annotated-tick_nohz_full_setup.patch clocksource-drivers-ixp4xx-drop-boardfile-probe-path.patch +bcache-memset-on-stack-variables-in-bch_btree_check-and-bch_sectors_dirty_init.patch -- 2.47.3