From: Christoph Hellwig <hch@lst.de>
To: Cunlong Li <shenxiaogll@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Jens Axboe <axboe@kernel.dk>,
Andrew Morton <akpm@linux-foundation.org>,
Christoph Hellwig <hch@lst.de>,
linux-block@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 1/2] zram: fix use-after-free in zram_bvec_write_partial()
Date: Wed, 27 May 2026 09:24:14 +0200 [thread overview]
Message-ID: <20260527072414.GA17856@lst.de> (raw)
In-Reply-To: <20260527-zram-v2-1-2fb84b054b5c@gmail.com>
On Wed, May 27, 2026 at 12:49:24PM +0800, Cunlong Li wrote:
> zram_read_page() picks the sync or async backing device read path
> based on whether the parent bio is NULL. zram_bvec_write_partial()
> passes its parent bio down, so for ZRAM_WB slots the read is
> dispatched asynchronously and zram_read_page() returns 0 while the
> bio is still in flight. The caller then runs memcpy_from_bvec(),
> zram_write_page() and __free_page() on the buffer, leaving the
> async read to write into a freed page.
>
> zram_bvec_read_partial() was switched to NULL in commit 4e3c87b9421d
> ("zram: fix synchronous reads") for the same reason; the
> write_partial counterpart was missed.
>
> Fixes: 4e3c87b9421d ("zram: fix synchronous reads")
That's just the last patch touching the line. This bio chaining goes
further back. AFAICS all the way to introducing backing device support
in: 8e654f8fbff5 ("zram: read page from backing device")
The patch itself looks good, though:
Reviewed-by: Christoph Hellwig <hch@lst.de>
next prev parent reply other threads:[~2026-05-27 7:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 4:49 [PATCH v2 0/2] zram: fix UAF in zram_bvec_write_partial() and drop dead bio plumbing Cunlong Li
2026-05-27 4:49 ` [PATCH v2 1/2] zram: fix use-after-free in zram_bvec_write_partial() Cunlong Li
2026-05-27 7:24 ` Christoph Hellwig [this message]
2026-05-27 14:13 ` Cunlong Li
2026-05-27 4:49 ` [PATCH v2 2/2] zram: drop unused bio parameter from write helpers Cunlong Li
2026-05-27 7:24 ` Christoph Hellwig
2026-05-27 7:21 ` [PATCH v2 0/2] zram: fix UAF in zram_bvec_write_partial() and drop dead bio plumbing Sergey Senozhatsky
2026-05-27 14:15 ` Cunlong Li
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=20260527072414.GA17856@lst.de \
--to=hch@lst.de \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=senozhatsky@chromium.org \
--cc=shenxiaogll@gmail.com \
--cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox