Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 6.1.y 0/3] zram: wait for backing reads before partial I/O uses the page
@ 2026-11-29 17:58 Dickson Wu via B4 Relay
  2026-11-29 17:58 ` [PATCH 6.1.y 1/3] zram: fix synchronous reads Dickson Wu via B4 Relay
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dickson Wu via B4 Relay @ 2026-11-29 17:58 UTC (permalink / raw)
  To: stable
  Cc: hch, akpm, senozhatsky, minchan, ngupta, linux-block, axboe,
	shenxiaogll

This replaces a 6.1 backport of commit 732fd9f0b9c1 ("zram: fix
use-after-free in zram_bvec_write_partial()"), which failed to apply
in <2026061535-fraying-pronto-cba0@gregkh>.

On 6.1 a partial read or write of a written-back slot goes through
read_from_bdev_sync(), but its worker only submits the read and
returns. The caller then copies from or frees the temporary page while
the read is still in flight. Upstream fixed that worker in commit
4e3c87b9421d ("zram: fix synchronous reads") and commit 1e9460d132cc
("zram: return errors from read_from_bdev_sync"), which never came to
6.1. This series backports those two plus commit 1b1a4e4d6797 ("zram:
read slot block idx under slot lock").

The one-line upstream fix itself isn't included. It passes a NULL
parent to pick the sync path, but 6.1 picks it by partial_io, and a NULL
parent on a written-back slot returns -EOPNOTSUPP there. After patches
1 and 2 the partial path already waits and returns the read status.

Tested on v6.1.193:
- arm64 with 64K pages (the only config that uses the sync worker),
  W=1 build of drivers/block/zram/zram_drv.o, base vs patched with the
  same config, no new warnings.
- In a QEMU guest, a slot was written back to a backing device, then
  read and written with partial I/O. Both data checks failed on the
  base kernel and passed with the series.
- A full-page writeback smoke boot passed on both kernels.

The backport and the test runs were prepared with AI coding tools
(OpenAI Codex agents, with review by Claude). I went over the result
before signing off.

---
Christoph Hellwig (2):
      zram: fix synchronous reads
      zram: return errors from read_from_bdev_sync

Sergey Senozhatsky (1):
      zram: read slot block idx under slot lock

 drivers/block/zram/zram_drv.c | 39 ++++++++++++++++++---------------------
 1 file changed, 18 insertions(+), 21 deletions(-)
---
base-commit: 1ca1436ccc68275d0b43b6a730b3940fcc46b7c2
change-id: 20261129-zram-sync-61c-20feda041c34

Best regards,
--  
Dickson Wu <dickson.wu@certik.com>



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

end of thread, other threads:[~2026-12-02 13:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 17:58 [PATCH 6.1.y 0/3] zram: wait for backing reads before partial I/O uses the page Dickson Wu via B4 Relay
2026-11-29 17:58 ` [PATCH 6.1.y 1/3] zram: fix synchronous reads Dickson Wu via B4 Relay
2026-11-29 17:58 ` [PATCH 6.1.y 2/3] zram: return errors from read_from_bdev_sync Dickson Wu via B4 Relay
2026-11-29 17:58 ` [PATCH 6.1.y 3/3] zram: read slot block idx under slot lock Dickson Wu via B4 Relay
2026-12-02 13:48 ` [PATCH 6.1.y 0/3] zram: wait for backing reads before partial I/O uses the page Sasha Levin

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