lkml.org 
[lkml]   [2024]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v1] erofs: use raw_smp_processor_id() to get buffer from global buffer pool
From
Hi Sandeep,

On 2024/4/9 05:52, Sandeep Dhavale wrote:
> erofs will decompress in the preemptible context (kworker or per cpu
> thread). As smp_processor_id() cannot be used in preemptible contexts,
> use raw_smp_processor_id() instead to index into global buffer pool.
>
> Reported-by: syzbot+27cc650ef45b379dfe5a@syzkaller.appspotmail.com
> Fixes: 7a7513292cc6 ("erofs: rename per-CPU buffers to global buffer pool and make it configurable")
> Signed-off-by: Sandeep Dhavale <dhavale@google.com>

Thanks for catching this, since the original patch is
for next upstream cycle, may I fold this fix in the
original patch?

I will add your credit into the original patch.

Thanks,
Gao Xiang

> ---
> fs/erofs/zutil.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c
> index b9b99158bb4e..036024bce9f7 100644
> --- a/fs/erofs/zutil.c
> +++ b/fs/erofs/zutil.c
> @@ -30,7 +30,7 @@ static struct shrinker *erofs_shrinker_info;
>
> static unsigned int z_erofs_gbuf_id(void)
> {
> - return smp_processor_id() % z_erofs_gbuf_count;
> + return raw_smp_processor_id() % z_erofs_gbuf_count;
> }
>
> void *z_erofs_get_gbuf(unsigned int requiredpages)

\
 
 \ /
  Last update: 2024-05-27 16:30    [W:0.061 / U:1.904 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site