Files
erofs-linux/drivers/block
Sergey Senozhatsky 7cbce1eaeb zram: protect recomp_algorithm_show() with ->init_lock
sysfs handlers should be called under ->init_lock and are not supposed to
unlock it until return, otherwise e.g.  a concurrent reset() can occur. 
There is one handler that breaks that rule: recomp_algorithm_show().

Move ->init_lock handling outside of __comp_algorithm_show() (also drop it
and call zcomp_available_show() directly) so that the entire
recomp_algorithm_show() loop is protected by the lock, as opposed to
protecting individual iterations.

The patch does not need to go to -stable, as it does not fix any
runtime errors (at least I can't think of any).  It makes
recomp_algorithm_show() "atomic" w.r.t.  zram reset() (just like the
rest of zram sysfs show() handlers), that's a pretty minor change.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Sergey Senozhatsky <[email protected]>
Reported-by: Seyediman Seyedarab <[email protected]>
Suggested-by: Seyediman Seyedarab <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Minchan Kim <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
2025-09-13 16:54:43 -07:00
..
2025-07-09 22:42:08 -07:00
2025-05-07 07:31:07 -06:00
…
…
2025-07-07 07:02:42 -06:00
2025-07-07 07:02:42 -06:00
…
…
…
…
…
…
…