<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/git/stable/linux.git/drivers/block/zram, branch master</title>
<subtitle>Linux kernel stable tree</subtitle>
<id>https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/atom?h=master</id>
<link rel='self' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/'/>
<updated>2026-08-25T01:43:19+00:00</updated>
<entry>
<title>zram: fix slot lock bit position on big-endian 64-bit</title>
<updated>2026-08-25T01:43:19+00:00</updated>
<author>
<name>David Carlier</name>
<email>devnexen@gmail.com</email>
</author>
<published>2026-08-10T20:22:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a8b5875741d416703e19ad8eeac6fce8a12bd6e4'/>
<id>urn:sha1:a8b5875741d416703e19ad8eeac6fce8a12bd6e4</id>
<content type='text'>
The slot lock is a bit operation on the whole __lock word, which flags and
ac_time alias as two u32s.  On little-endian the lock bit lands in the
position ZRAM_ENTRY_LOCK reserves in flags, so the aliasing works out.  On
64-bit big-endian it lands in ac_time instead: with
ZRAM_TRACK_ENTRY_ACTIME enabled, storing the access time from
mark_slot_accessed() or slot_free() wipes out the held lock bit, letting
another CPU take the same slot lock; an access time value with that bit
set makes the slot look locked forever.

Shift the lock bit into the flags half of the word on big-endian 64-bit.

Link: https://lore.kernel.org/20260810202241.2436603-1-devnexen@gmail.com
Fixes: 2e8ff2f51dde ("zram: use u32 for entry ac_time tracking")
Signed-off-by: David Carlier &lt;devnexen@gmail.com&gt;
Reviewed-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>zram: switch to unsigned long indexing</title>
<updated>2026-08-25T01:43:06+00:00</updated>
<author>
<name>Sergey Senozhatsky</name>
<email>senozhatsky@chromium.org</email>
</author>
<published>2026-08-06T03:16:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=184bf187c45ba6c1141aa7fe10bf10f85d5a7634'/>
<id>urn:sha1:184bf187c45ba6c1141aa7fe10bf10f85d5a7634</id>
<content type='text'>
zram has always used "unsigned int" for (page) index calculations, which
unnecessarily limited max zram disksize.

Switch to "unsigned long" and permit much larger zram devices.

Link: https://lore.kernel.org/20260806031640.536615-1-senozhatsky@chromium.org
Signed-off-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Suggested-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Co-developed-by: Longlong Xia &lt;xialonglong2025@163.com&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>zram: fix out-of-bounds access in read_block_state()</title>
<updated>2026-08-25T01:43:05+00:00</updated>
<author>
<name>Longlong Xia</name>
<email>xialonglong@kylinos.cn</email>
</author>
<published>2026-08-04T06:59:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=391f057f44a51cc9418da5cba78b014324174264'/>
<id>urn:sha1:391f057f44a51cc9418da5cba78b014324174264</id>
<content type='text'>
read_block_state() calculates nr_pages before taking dev_lock.  If the
device is reset and reinitialized with a smaller disksize before lock
acquisition, nr_pages still describes the old table.  The subsequent loop
can then call slot_lock() past the end of the newly allocated table.

Read disksize after acquiring dev_lock and checking that the device is
initialized.  The read lock then keeps the table and its bound stable for
the duration of the scan.

Link: https://lore.kernel.org/20260804065919.3970386-3-xialonglong2025@163.com
Fixes: c0265342bff4 ("zram: introduce zram memory tracking")
Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Longlong Xia &lt;xialonglong@kylinos.cn&gt;
Reviewed-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>zram: fix out-of-bounds access in writeback_store()</title>
<updated>2026-08-25T01:43:05+00:00</updated>
<author>
<name>Longlong Xia</name>
<email>xialonglong@kylinos.cn</email>
</author>
<published>2026-08-04T06:59:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=894913e2d35c46ff19a77530907771ae57862b96'/>
<id>urn:sha1:894913e2d35c46ff19a77530907771ae57862b96</id>
<content type='text'>
Patch series "zram: fix stale scan bounds after reinitialization".

Both writeback_store() and read_block_state() derive their table scan
bounds from zram-&gt;disksize before acquiring dev_lock.  If the device is
reset and reinitialized with a smaller disksize between that read and lock
acquisition, the bound can describe the old table while the scan operates
on the new one.  This can lead to out-of-bounds slot accesses.

Move both bound calculations under dev_lock so each bound remains
consistent with the table throughout its scan.  Keep the fixes separate
because the affected interfaces originate from different commits and can
be backported independently.


This patch (of 2):

writeback_store() calculates the table scan bounds before taking dev_lock.
A reset followed by reconfiguration with a smaller disksize can therefore
replace zram-&gt;table while writeback_store() is waiting for the lock.  Once
it acquires the lock, it sees an initialized device but scans the new
table using the old upper bound, resulting in an out-of-bounds access.

Calculate the number of pages while holding dev_lock so the scan bound
matches the table protected by the lock.

Link: https://lore.kernel.org/20260804065919.3970386-1-xialonglong2025@163.com
Link: https://lore.kernel.org/20260804065919.3970386-2-xialonglong2025@163.com
Fixes: a939888ec38b ("zram: support idle/huge page writeback")
Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Longlong Xia &lt;xialonglong@kylinos.cn&gt;
Reviewed-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>zram: reset per-priority params when changing algorithm before init</title>
<updated>2026-08-25T01:43:05+00:00</updated>
<author>
<name>Haoqin Huang</name>
<email>haoqinhuang@tencent.com</email>
</author>
<published>2026-08-04T09:38:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=702c5a799db20e49fe67cdfa27bac65374ad00ab'/>
<id>urn:sha1:702c5a799db20e49fe67cdfa27bac65374ad00ab</id>
<content type='text'>
Parameters validated against one algorithm may be invalid for another
(e.g.  lz4 accepts level=65535 but zstd does not).  Although algorithm
changes are blocked after disksize is set, they are allowed before device
initialization.  Reset per-priority params on algorithm change so that
stale parameters do not silently carry over.

Link: https://lore.kernel.org/20260804093841.67920-6-haoqinhuang7@gmail.com
Signed-off-by: Haoqin Huang &lt;haoqinhuang@tencent.com&gt;
Signed-off-by: Rongwei Wang &lt;zigiwang@tencent.com&gt;
Reviewed-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Tested-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Cc: David Sterba &lt;dsterba@suse.com&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Nick Terrell &lt;terrelln@fb.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>zram: validate parameters in each backend's setup_params</title>
<updated>2026-08-25T01:43:04+00:00</updated>
<author>
<name>Haoqin Huang</name>
<email>haoqinhuang@tencent.com</email>
</author>
<published>2026-08-04T09:38:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7b0f677c7bd539bd5695b14f9a195e257c3b4463'/>
<id>urn:sha1:7b0f677c7bd539bd5695b14f9a195e257c3b4463</id>
<content type='text'>
Dict and level parameters are silently accepted even for backends that do
not support them.  Validate these parameters in each backend's
.setup_params() to reject unsupported combinations and out-of-range levels
with a specific error message.

Link: https://lore.kernel.org/20260804093841.67920-5-haoqinhuang7@gmail.com
Signed-off-by: Haoqin Huang &lt;haoqinhuang@tencent.com&gt;
Signed-off-by: Rongwei Wang &lt;zigiwang@tencent.com&gt;
Reviewed-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Tested-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Cc: David Sterba &lt;dsterba@suse.com&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Nick Terrell &lt;terrelln@fb.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>zram: add pr_fmt to backend files</title>
<updated>2026-08-25T01:43:04+00:00</updated>
<author>
<name>Haoqin Huang</name>
<email>haoqinhuang@tencent.com</email>
</author>
<published>2026-08-04T09:38:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=70922d5ef84a5863ac80d4b13f574cb9e461a716'/>
<id>urn:sha1:70922d5ef84a5863ac80d4b13f574cb9e461a716</id>
<content type='text'>
Add pr_fmt to each backend so that pr_err() messages are auto-prefixed
with the algorithm name.  While at it, tweak the deflate winbits pr_err to
avoid a duplicated "deflate" prefix.

Link: https://lore.kernel.org/20260804093841.67920-4-haoqinhuang7@gmail.com
Signed-off-by: Haoqin Huang &lt;haoqinhuang@tencent.com&gt;
Signed-off-by: Rongwei Wang &lt;zigiwang@tencent.com&gt;
Reviewed-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Tested-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Cc: David Sterba &lt;dsterba@suse.com&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Nick Terrell &lt;terrelln@fb.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>zram: reject zero-size dictionary</title>
<updated>2026-08-25T01:43:04+00:00</updated>
<author>
<name>Haoqin Huang</name>
<email>haoqinhuang@tencent.com</email>
</author>
<published>2026-08-04T09:38:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=6dc404d433adf09045565054aecf85714db95b46'/>
<id>urn:sha1:6dc404d433adf09045565054aecf85714db95b46</id>
<content type='text'>
kernel_read_file_from_path() already rejects empty files (i_size &lt;= 0) and
returns -EINVAL, but the current implementation only checks for sz &lt; 0
without logging any information.  Use sz == 0 to reject the zero-size case
and print distinct error messages for each failure type.

Link: https://lore.kernel.org/20260804093841.67920-3-haoqinhuang7@gmail.com
Signed-off-by: Haoqin Huang &lt;haoqinhuang@tencent.com&gt;
Signed-off-by: Rongwei Wang &lt;zigiwang@tencent.com&gt;
Reviewed-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Tested-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Cc: David Sterba &lt;dsterba@suse.com&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Nick Terrell &lt;terrelln@fb.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>zram: do not release zstd global params from error paths</title>
<updated>2026-08-25T01:43:04+00:00</updated>
<author>
<name>Haoqin Huang</name>
<email>haoqinhuang@tencent.com</email>
</author>
<published>2026-08-04T09:38:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=45214458d6b50124afef3187f6352adeddf74d6f'/>
<id>urn:sha1:45214458d6b50124afef3187f6352adeddf74d6f</id>
<content type='text'>
Patch series "zram: fix zstd error paths and add parameter validation", v6,

Patch 1 removes zstd_release_params() from both zstd_create() and
zstd_setup_params() error paths -- the former is a layering violation
in a per-CPU callback, the latter is redundant as zcomp_init() already
calls release_params() on setup failure.

Patch 2 rejects zero-size dictionaries and prints distinct error
messages for sz &lt; 0 (returns the original error code) and sz == 0
("empty file"). Currently errors are silently swallowed.

Patch 3 adds pr_fmt to each backend file so that pr_err() messages
are auto-prefixed with the algorithm name.

Patch 4 validates dict and level parameters in each backend's
.setup_params(), rejecting unsupported combinations and out-of-range
levels.

Patch 5 resets per-priority params on algorithm change before init.


This patch (of 5):

zstd_setup_params() creates global cdict and ddict stored in
params-&gt;drv_data, shared across all per-CPU contexts.  The per-CPU
zstd_create() error path called zstd_release_params(), which freed those
globally-shared objects.  This is a layering violation: a per-CPU callback
should only clean up its own context, not release resources owned by the
compression lifecycle.

zstd_setup_params() called zstd_release_params() on its own error path as
well, but zcomp_init() already calls release_params() when setup fails, so
this is redundant.

Remove zstd_release_params() from both error paths.

Link: https://lore.kernel.org/20260804093841.67920-1-haoqinhuang7@gmail.com
Link: https://lore.kernel.org/20260804093841.67920-2-haoqinhuang7@gmail.com
Signed-off-by: Haoqin Huang &lt;haoqinhuang@tencent.com&gt;
Signed-off-by: Rongwei Wang &lt;zigiwang@tencent.com&gt;
Reviewed-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Tested-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Cc: David Sterba &lt;dsterba@suse.com&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Nick Terrell &lt;terrelln@fb.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>zram: validate deflate params</title>
<updated>2026-08-25T01:42:56+00:00</updated>
<author>
<name>Sergey Senozhatsky</name>
<email>senozhatsky@chromium.org</email>
</author>
<published>2026-07-29T04:57:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.rulkc.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ec7607ac4717ff521c9c1e9d8271c26293345513'/>
<id>urn:sha1:ec7607ac4717ff521c9c1e9d8271c26293345513</id>
<content type='text'>
We must validate user-supplied deflate winbits before we pass it to
zlib_deflate_workspacesize(), which triggers BUG_ON() if winbits value is
outside of valid ranges.

Link: https://lore.kernel.org/20260729045745.775973-3-senozhatsky@chromium.org
Fixes: dc75a0d93bd5 ("zram: support deflate-specific params")
Link: https://sashiko.dev/#/patchset/20260728092935.31139-1-haoqinhuang7@gmail.com
Signed-off-by: Sergey Senozhatsky &lt;senozhatsky@chromium.org&gt;
Cc: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Haoqin Huang &lt;haoqinhuang7@gmail.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
</feed>
