Linux block layer
 help / color / mirror / Atom feed
* [PATCH 0/2] zram: fix stale scan bounds after reinitialization
@ 2026-08-04  6:59 Longlong Xia
  2026-08-04  6:59 ` [PATCH 1/2] zram: fix out-of-bounds access in writeback_store() Longlong Xia
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Longlong Xia @ 2026-08-04  6:59 UTC (permalink / raw)
  To: Minchan Kim, Sergey Senozhatsky
  Cc: Jens Axboe, linux-block, linux-kernel, Longlong Xia

From: Longlong Xia <xialonglong@kylinos.cn>

Both writeback_store() and read_block_state() derive their table scan
bounds from zram->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.

The series has been checked with:

  scripts/checkpatch.pl --strict <patches>
  make M=drivers/block/zram modules

Longlong Xia (2):
  zram: fix out-of-bounds access in writeback_store()
  zram: fix out-of-bounds access in read_block_state()

 drivers/block/zram/zram_drv.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)


base-commit: 848acc8ffe1b7cd5f1bf427b93069becfebc2c9d
-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-08-05 11:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-04  6:59 [PATCH 0/2] zram: fix stale scan bounds after reinitialization Longlong Xia
2026-08-04  6:59 ` [PATCH 1/2] zram: fix out-of-bounds access in writeback_store() Longlong Xia
2026-08-04  8:41   ` Sergey Senozhatsky
2026-08-04  6:59 ` [PATCH 2/2] zram: fix out-of-bounds access in read_block_state() Longlong Xia
2026-08-04  8:42   ` Sergey Senozhatsky
2026-08-04 20:10 ` [PATCH 0/2] zram: fix stale scan bounds after reinitialization Andrew Morton
2026-08-05  1:42   ` Sergey Senozhatsky
2026-08-05 11:26     ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox