Re: [PATCH] erofs: fix use-after-free on sbi->sync_decompress

Chao Yu <[email protected]>
Newsgroups org.ozlabs.lists.linux-erofs,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 5/22/26 16:27, Gao Xiang wrote:
> z_erofs_decompress_kickoff() can race with filesystem unmount, causing
> a use-after-free on sbi->sync_decompress.
> 
> When I/O completes, z_erofs_endio() calls z_erofs_decompress_kickoff()
> to queue z_erofs_decompressqueue_work() asynchronously. Then, after all
> folios are unlocked, unmount workflow can proceed and sbi will be freed
> before accessing to sbi->sync_decompress.
> 
> Thread (unmount)        I/O completion        kworker
>                          queue_work
>                                                z_erofs_decompressqueue_work
>                                                 (all folios are unlocked)
> cleanup_mnt
>   ..
>   erofs_kill_sb
>    erofs_sb_free
>     kfree(sbi)
>                          access sbi->sync_decompress  // UAF!!
> 
> Fixes: 40452ffca3c1 ("erofs: add sysfs node to control sync decompression strategy")
> Reported-by: [email protected]
> Closes: https://syzkaller.appspot.com/bug?extid=52bae5c495dbe261a0bc
> Signed-off-by: Gao Xiang <[email protected]>

Reviewed-by: Chao Yu <[email protected]>

Thanks,
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.