Re: [PATCH] erofs: fix out-of-bound access when z_erofs_gbuf_growsize() partially fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Chunhai,

On 2024/8/20 17:25, Chunhai Guo wrote:
在 2024/8/20 16:42, Gao Xiang 写道:
If z_erofs_gbuf_growsize() partially fails on a global buffer due to
memory allocation failure or fault injection (as reported by syzbot [1]),
new pages need to be freed by comparing to the existing pages to avoid
memory leaks.

However, the old gbuf->pages[] array may not be large enough, which can
lead to null-ptr-deref or out-of-bound access.

Fix this by checking against gbuf->nrpages in advance.

Fixes: d6db47e571dc ("erofs: do not use pagepool in z_erofs_gbuf_growsize()")
Cc: <stable@xxxxxxxxxxxxxxx> # 6.10+
Cc: Chunhai Guo <guochunhai@xxxxxxxx>
Signed-off-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx>

Reviewed-by: Chunhai Guo <guochunhai@xxxxxxxx>

I've sent a patch to add links and reported-by.

I assume I can add your reviewed-by to that version too?

Thanks,
Gao Xiang


Thanks,

Chunhai Guo





[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux