From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,minchan@kernel.org,gaoxu2@honor.com,bgeffon@google.com,axboe@kernel.dk,senozhatsky@chromium.org,akpm@linux-foundation.org
Subject: + zram-do-not-autocorrect-bad-recompression-parameters.patch added to mm-unstable branch
Date: Wed, 11 Mar 2026 11:12:48 -0700 [thread overview]
Message-ID: <20260311181248.F25FEC4CEF7@smtp.kernel.org> (raw)
The patch titled
Subject: zram: do not autocorrect bad recompression parameters
has been added to the -mm mm-unstable branch. Its filename is
zram-do-not-autocorrect-bad-recompression-parameters.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/zram-do-not-autocorrect-bad-recompression-parameters.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: zram: do not autocorrect bad recompression parameters
Date: Wed, 11 Mar 2026 17:42:45 +0900
Do not silently autocorrect bad recompression priority parameter value and
just error out.
Link: https://lkml.kernel.org/r/20260311084312.1766036-3-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Suggested-by: Minchan Kim <minchan@kernel.org>
Cc: Brian Geffon <bgeffon@google.com>
Cc: gao xu <gaoxu2@honor.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/block/zram/zram_drv.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
--- a/drivers/block/zram/zram_drv.c~zram-do-not-autocorrect-bad-recompression-parameters
+++ a/drivers/block/zram/zram_drv.c
@@ -2528,19 +2528,16 @@ static ssize_t recompress_store(struct d
struct device_attribute *attr,
const char *buf, size_t len)
{
+ u32 prio = ZRAM_SECONDARY_COMP, prio_max = ZRAM_MAX_COMPS;
struct zram *zram = dev_to_zram(dev);
char *args, *param, *val, *algo = NULL;
u64 num_recomp_pages = ULLONG_MAX;
struct zram_pp_ctl *ctl = NULL;
struct zram_pp_slot *pps;
u32 mode = 0, threshold = 0;
- u32 prio, prio_max;
struct page *page = NULL;
ssize_t ret;
- prio = ZRAM_SECONDARY_COMP;
- prio_max = zram->num_active_comps;
-
args = skip_spaces(buf);
while (*args) {
args = next_arg(args, ¶m, &val);
@@ -2590,10 +2587,7 @@ static ssize_t recompress_store(struct d
if (ret)
return ret;
- if (prio == ZRAM_PRIMARY_COMP)
- prio = ZRAM_SECONDARY_COMP;
-
- prio_max = prio + 1;
+ prio_max = min(prio + 1, ZRAM_MAX_COMPS);
continue;
}
}
@@ -2613,7 +2607,7 @@ static ssize_t recompress_store(struct d
continue;
if (!strcmp(zram->comp_algs[prio], algo)) {
- prio_max = prio + 1;
+ prio_max = min(prio + 1, ZRAM_MAX_COMPS);
found = true;
break;
}
@@ -2630,6 +2624,11 @@ static ssize_t recompress_store(struct d
ret = -EINVAL;
goto out;
}
+
+ if (prio < ZRAM_SECONDARY_COMP || prio >= ZRAM_MAX_COMPS) {
+ ret = -EINVAL;
+ goto out;
+ }
page = alloc_page(GFP_KERNEL);
if (!page) {
_
Patches currently in -mm which might be from senozhatsky@chromium.org are
zram-do-not-permit-params-change-after-init.patch
zram-do-not-autocorrect-bad-recompression-parameters.patch
zram-drop-num_active_comps.patch
zram-update-recompression-documentation.patch
zram-remove-chained-recompression.patch
zram-unify-and-harden-algo-priority-params-handling.patch
reply other threads:[~2026-03-11 18:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260311181248.F25FEC4CEF7@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=bgeffon@google.com \
--cc=gaoxu2@honor.com \
--cc=minchan@kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=senozhatsky@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.