Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

zram: reject unrecognized type= values in recompress_store()

recompress_store() parses the type= parameter with three if statements
checking for "idle", "huge", and "huge_idle". An unrecognized value
silently falls through with mode left at 0, causing the recompression pass
to run with no slot filter — processing all slots instead of the
intended subset.

Add a !mode check after the type parsing block to return -EINVAL for
unrecognized values, consistent with the function's other parameter
validation.

Link: https://lore.kernel.org/20260407153027.42425-1-astellman@stellman-greene.com
Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
Suggested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Andrew Stellman and committed by
Andrew Morton
2f529e73 9a8ea3c1

+2
+2
drivers/block/zram/zram_drv.c
··· 2546 2546 mode = RECOMPRESS_HUGE; 2547 2547 if (!strcmp(val, "huge_idle")) 2548 2548 mode = RECOMPRESS_IDLE | RECOMPRESS_HUGE; 2549 + if (!mode) 2550 + return -EINVAL; 2549 2551 continue; 2550 2552 } 2551 2553