diff options
author | Sergey Senozhatsky <senozhatsky@chromium.org> | 2025-08-05 13:19:29 +0300 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2025-09-14 02:54:43 +0300 |
commit | 7cbce1eaeb783af9e88fc5cebe9b18d46d9030bd (patch) | |
tree | b5eb591b5c081075779c892e6a241562dcf24227 /rust/helpers/vmalloc.c | |
parent | 79e1c24285c40cdfa9eb00fe8131d1ba14b84ef1 (diff) | |
download | linux-7cbce1eaeb783af9e88fc5cebe9b18d46d9030bd.tar.xz |
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/20250805101946.1774112-1-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reported-by: Seyediman Seyedarab <imandevel@gmail.com>
Suggested-by: Seyediman Seyedarab <imandevel@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'rust/helpers/vmalloc.c')
0 files changed, 0 insertions, 0 deletions