lkml.org 
[lkml]   [2024]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[syzbot] [erofs?] BUG: using smp_processor_id() in preemptible code in z_erofs_get_gbuf
Date
please test wrong context using smp_processor_id

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 2b3d5988ae2c

diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c
index 9687cad8be96..0a3d9eecbf16 100644
--- a/fs/erofs/zutil.c
+++ b/fs/erofs/zutil.c
@@ -35,8 +35,11 @@ void *z_erofs_get_gbuf(unsigned int requiredpages)
__acquires(gbuf->lock)
{
struct z_erofs_gbuf *gbuf;
+ unsigned long flags;

+ local_irq_save(flags);
gbuf = &z_erofs_gbufpool[z_erofs_gbuf_id()];
+ local_irq_restore(flags);
spin_lock(&gbuf->lock);
/* check if the buffer is too small */
if (requiredpages > gbuf->nrpages) {

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