All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] one bcache patch for stable tree
@ 2022-06-28  8:49 Coly Li
  2022-06-28  8:49 ` [PATCH 1/1] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init() Coly Li
  0 siblings, 1 reply; 6+ messages in thread
From: Coly Li @ 2022-06-28  8:49 UTC (permalink / raw)
  To: gregkh; +Cc: stable

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(+)

-- 
2.35.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/1] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()
  2022-06-28  8:49 [PATCH 0/1] one bcache patch for stable tree Coly Li
@ 2022-06-28  8:49 ` Coly Li
  2022-06-28  9:10   ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Coly Li @ 2022-06-28  8:49 UTC (permalink / raw)
  To: gregkh; +Cc: stable

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 <colyli@suse.de>
Link: https://lore.kernel.org/r/20220527152818.27545-2-colyli@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 drivers/md/bcache/btree.c     | 1 +
 drivers/md/bcache/writeback.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index 2362bb8ef6d1..e136d6edc1ed 100644
--- 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;
diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
index 75b71199800d..d138a2d73240 100644
--- a/drivers/md/bcache/writeback.c
+++ b/drivers/md/bcache/writeback.c
@@ -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();
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()
  2022-06-28  8:49 ` [PATCH 1/1] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init() Coly Li
@ 2022-06-28  9:10   ` Greg KH
  2022-06-28  9:29     ` Coly Li
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2022-06-28  9:10 UTC (permalink / raw)
  To: Coly Li; +Cc: stable

On Tue, Jun 28, 2022 at 04:49:33PM +0800, Coly Li wrote:
> 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 <colyli@suse.de>
> Link: https://lore.kernel.org/r/20220527152818.27545-2-colyli@suse.de
> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> ---
>  drivers/md/bcache/btree.c     | 1 +
>  drivers/md/bcache/writeback.c | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
> index 2362bb8ef6d1..e136d6edc1ed 100644
> --- 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;
> diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
> index 75b71199800d..d138a2d73240 100644
> --- a/drivers/md/bcache/writeback.c
> +++ b/drivers/md/bcache/writeback.c
> @@ -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();
> -- 
> 2.35.3
> 

What is the git commit id of this patch in Linus's tree?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()
  2022-06-28  9:10   ` Greg KH
@ 2022-06-28  9:29     ` Coly Li
  2022-06-30 11:18       ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Coly Li @ 2022-06-28  9:29 UTC (permalink / raw)
  To: Greg KH; +Cc: stable



> 2022年6月28日 17:10,Greg KH <gregkh@linuxfoundation.org> 写道:
> 
> On Tue, Jun 28, 2022 at 04:49:33PM +0800, Coly Li wrote:
>> 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 <colyli@suse.de>
>> Link: https://lore.kernel.org/r/20220527152818.27545-2-colyli@suse.de
>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>> ---
>> drivers/md/bcache/btree.c     | 1 +
>> drivers/md/bcache/writeback.c | 1 +
>> 2 files changed, 2 insertions(+)
>> 
>> diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
>> index 2362bb8ef6d1..e136d6edc1ed 100644
>> --- 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;
>> diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
>> index 75b71199800d..d138a2d73240 100644
>> --- a/drivers/md/bcache/writeback.c
>> +++ b/drivers/md/bcache/writeback.c
>> @@ -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();
>> -- 
>> 2.35.3
>> 
> 
> What 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()
  2022-06-28  9:29     ` Coly Li
@ 2022-06-30 11:18       ` Greg KH
  2022-06-30 14:32         ` Coly Li
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2022-06-30 11:18 UTC (permalink / raw)
  To: Coly Li; +Cc: stable

On Tue, Jun 28, 2022 at 05:29:44PM +0800, Coly Li wrote:
> 
> 
> > 2022年6月28日 17:10,Greg KH <gregkh@linuxfoundation.org> 写道:
> > 
> > On Tue, Jun 28, 2022 at 04:49:33PM +0800, Coly Li wrote:
> >> 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 <colyli@suse.de>
> >> Link: https://lore.kernel.org/r/20220527152818.27545-2-colyli@suse.de
> >> Signed-off-by: Jens Axboe <axboe@kernel.dk>
> >> ---
> >> drivers/md/bcache/btree.c     | 1 +
> >> drivers/md/bcache/writeback.c | 1 +
> >> 2 files changed, 2 insertions(+)
> >> 
> >> diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
> >> index 2362bb8ef6d1..e136d6edc1ed 100644
> >> --- 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;
> >> diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
> >> index 75b71199800d..d138a2d73240 100644
> >> --- a/drivers/md/bcache/writeback.c
> >> +++ b/drivers/md/bcache/writeback.c
> >> @@ -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();
> >> -- 
> >> 2.35.3
> >> 
> > 
> > What 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, now queued up.

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()
  2022-06-30 11:18       ` Greg KH
@ 2022-06-30 14:32         ` Coly Li
  0 siblings, 0 replies; 6+ messages in thread
From: Coly Li @ 2022-06-30 14:32 UTC (permalink / raw)
  To: Greg KH; +Cc: stable



> 2022年6月30日 19:18,Greg KH <gregkh@linuxfoundation.org> 写道:
> 
> On Tue, Jun 28, 2022 at 05:29:44PM +0800, Coly Li wrote:
>> 
>> 
>>> 2022年6月28日 17:10,Greg KH <gregkh@linuxfoundation.org> 写道:
>>> 
>>> On Tue, Jun 28, 2022 at 04:49:33PM +0800, Coly Li wrote:
>>>> 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 <colyli@suse.de>
>>>> Link: https://lore.kernel.org/r/20220527152818.27545-2-colyli@suse.de
>>>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>>>> ---
>>>> drivers/md/bcache/btree.c     | 1 +
>>>> drivers/md/bcache/writeback.c | 1 +
>>>> 2 files changed, 2 insertions(+)
>>>> 
>>>> diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
>>>> index 2362bb8ef6d1..e136d6edc1ed 100644
>>>> --- 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;
>>>> diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
>>>> index 75b71199800d..d138a2d73240 100644
>>>> --- a/drivers/md/bcache/writeback.c
>>>> +++ b/drivers/md/bcache/writeback.c
>>>> @@ -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();
>>>> -- 
>>>> 2.35.3
>>>> 
>>> 
>>> What 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, now queued up.

Nice, thank you for taking care of it :-)

Coly Li


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-30 14:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28  8:49 [PATCH 0/1] one bcache patch for stable tree Coly Li
2022-06-28  8:49 ` [PATCH 1/1] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init() Coly Li
2022-06-28  9:10   ` Greg KH
2022-06-28  9:29     ` Coly Li
2022-06-30 11:18       ` Greg KH
2022-06-30 14:32         ` Coly Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.