Re: [PATCH 2/2] zram: fix out-of-bounds access in read_block_state()

Sergey Senozhatsky <[email protected]>
Newsgroups gmane.linux.kernel.stable,gmane.linux.block,gmane.linux.kernel
Message-ID <[email protected]>
On (26/08/04 14:59), Longlong Xia wrote:
> 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.
> 
> Fixes: c0265342bff4 ("zram: introduce zram memory tracking")
> Cc: <[email protected]>
> Assisted-by: Codex:gpt-5.6-sol
> Signed-off-by: Longlong Xia <[email protected]>

Reviewed-by: Sergey Senozhatsky <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.