one bcache patch for stable tree
Subsystems (2)
cover one bcache patch for stable tree
Hi Greg,
This is a bcache patch upstreamed in Linux v5.19, it fixes the undefined stack state which I feel it should go into stable tree as well.
I go through all the stable releases since Linux v5.10, based on current stable tree maintenance status, this patch should be applied to the following stable kernel releases,
- longterm: 5.10, 5.15
- 5.17, 5.18
Please consider to take it for the above stable kernels. Thank you in advance for taking care of them.
Coly Li
---
Coly Li (1):
bcache: memset on stack variables in bch_btree_check() and
bch_sectors_dirty_init()
drivers/md/bcache/btree.c | 1 + drivers/md/bcache/writeback.c | 1 + 2 files changed, 2 insertions(+)
Signature · 1 line
2.35.3
PATCH 1/1 bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()
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().
--- drivers/md/bcache/btree.c | 1 + drivers/md/bcache/writeback.c | 1 + 2 files changed, 2 insertions(+)
drivers/md/bcache/btree.c +1 -0
@@ -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 ;
drivers/md/bcache/writeback.c +1 -0
@@ -950,6 +950,7 @@ void bch_sectors_dirty_init(struct bcache_device *d)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 ();
Signature · 1 line
2.35.3
Greg KH
maintainerRe: [PATCH 1/1] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()
Quoted 39 lines · Coly Li
The local variables
check_state(inbch_btree_check()) and state (inbch_sectors_dirty_init()) should be fully filled by 0, because before allocating them on stack, they were dynamically allocated bykzalloc().Signed-off-by Coly Li <[email protected]>Signed-off-by Jens Axboe <[email protected]>--- drivers/md/bcache/btree.c | 1 + drivers/md/bcache/writeback.c | 1 + 2 files changed, 2 insertions(+)drivers/md/bcache/btree.c +1
-0@@ -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 ;drivers/md/bcache/writeback.c +1
-0@@ -950,6 +950,7 @@ void bch_sectors_dirty_init(struct bcache_device *d)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 ();Signature · 1 line
2.35.3
What is the git commit id of this patch in Linus's tree?
thanks,
greg k-h
Re: [PATCH 1/1] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()
Quoted 37 lines
2022年6月28日 17:10,Greg KH <[email protected]> 写道:
Quoted 32 lines · Coly Li
The local variables
check_state(inbch_btree_check()) and state (inbch_sectors_dirty_init()) should be fully filled by 0, because before allocating them on stack, they were dynamically allocated bykzalloc().Signed-off-by Coly Li <[email protected]>Signed-off-by Jens Axboe <[email protected]>---
drivers/md/bcache/btree.c| 1 +drivers/md/bcache/writeback.c| 1 +2 files changed, 2 insertions(+)drivers/md/bcache/btree.c +1
-0@@ -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 ;drivers/md/bcache/writeback.c +0
-0@@ -950,6 +950,7 @@ void bch_sectors_dirty_init(struct bcache_device *d)return ; }
Quoted 9 lines
Quoted 7 lines
drivers/md/bcache/writeback.c +1
-0+memset (&state,0 ,sizeof (struct bch_dirty_init_state )); state.c = c; state.d = d; state.total_threads =bch_btre_dirty_init_thread_nr ();Signature · 1 line
2.35.3What is the git commit id of this patch in Linus's tree?
Oops, the commit tag in email was filtered out. This patch in Linus tree is
commit 7d6b902ea0e0 (“bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()”)
Thanks.
Coly Li
Greg KH
maintainerRe: [PATCH 1/1] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()
Quoted 48 lines · Coly Li
Quoted 37 lines
2022年6月28日 17:10,Greg KH <[email protected]> 写道:
Quoted 32 lines · Coly Li
The local variables
check_state(inbch_btree_check()) and state (inbch_sectors_dirty_init()) should be fully filled by 0, because before allocating them on stack, they were dynamically allocated bykzalloc().Signed-off-by Coly Li <[email protected]>Signed-off-by Jens Axboe <[email protected]>---
drivers/md/bcache/btree.c| 1 +drivers/md/bcache/writeback.c| 1 +2 files changed, 2 insertions(+)drivers/md/bcache/btree.c +1
-0@@ -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 ;drivers/md/bcache/writeback.c +0
-0@@ -950,6 +950,7 @@ void bch_sectors_dirty_init(struct bcache_device *d)return ; }Quoted 9 lines
Quoted 7 lines
drivers/md/bcache/writeback.c +1
-0+memset (&state,0 ,sizeof (struct bch_dirty_init_state )); state.c = c; state.d = d; state.total_threads =bch_btre_dirty_init_thread_nr ();Signature · 1 line
2.35.3What is the git commit id of this patch in Linus's tree?
Quoted 3 lines
Oops, the commit tag in email was filtered out. This patch in Linus tree is
commit
7d6b902ea0e0(“bcache: memset on stack variables inbch_btree_check()and bch_sectors_dirty_init()”)
Thanks, now queued up.
greg k-h
Re: [PATCH 1/1] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()
Quoted 53 lines
2022年6月30日 19:18,Greg KH <[email protected]> 写道:
Quoted 48 lines · Coly Li
Quoted 46 lines
2022年6月28日 17:10,Greg KH <[email protected]> 写道:
Quoted 39 lines · Coly Li
The local variables
check_state(inbch_btree_check()) and state (inbch_sectors_dirty_init()) should be fully filled by 0, because before allocating them on stack, they were dynamically allocated bykzalloc().Signed-off-by Coly Li <[email protected]>Signed-off-by Jens Axboe <[email protected]>---
drivers/md/bcache/btree.c| 1 +drivers/md/bcache/writeback.c| 1 +2 files changed, 2 insertions(+)drivers/md/bcache/btree.c +1
-0@@ -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 ;drivers/md/bcache/writeback.c +1
-0@@ -950,6 +950,7 @@ void bch_sectors_dirty_init(struct bcache_device *d)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 ();Signature · 1 line
2.35.3What is the git commit id of this patch in Linus's tree?
Quoted 5 lines
Quoted 3 lines
Oops, the commit tag in email was filtered out. This patch in Linus tree is
commit
7d6b902ea0e0(“bcache: memset on stack variables inbch_btree_check()and bch_sectors_dirty_init()”)Thanks, now queued up.
Nice, thank you for taking care of it :-)
Coly Li