From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A215038B122 for ; Fri, 22 May 2026 13:00:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779454850; cv=none; b=t3Y2+Tky7WMF3hbQucfl3bjKErO4WGpLt7E+cRHfmDnlvIN8n3d8aTf1ebOyp8unpAEIE434ukis0xZ7DgaqRz/5CjlIakDSJFRkus+TQsE1ovvRUoYCcSrYFX/JzDCmVOrTnTKKMlfYf/IXKuVyO+cMh0dWFhCaInJU9tvlRO0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779454850; c=relaxed/simple; bh=QZ/Sbt4X+Is4+faEvUFPHg4FYjTpbkd+0OWsN7FsYbM=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=QKyRz109typhEL17r28EoRGpu6SVNNX7X0WTmgQfjcOMEKGQvTHpahtbuOB8B4wde8mgsEMxxPe/+3/ao1qinMSjwGSirX+NSnofetJX28DjY38Y9VhiuDeRPD2x9BgD5nMSC7Gkm3ozyHIXTWWgf7zdxg4xoAlRMU3OO+hjcKo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ORdRuBAV; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ORdRuBAV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78DB01F000E9; Fri, 22 May 2026 13:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779454849; bh=OdGOR+CUQyFp0PV7PuODPQaFA4X8MLPl0TjPH8ZUT18=; h=Date:Cc:Subject:To:References:From:In-Reply-To; b=ORdRuBAVydQRpL1PrvM/X5gpv3T0dRzn8dkIcm9HgZ2yuDAduWpEiXA9TRvXfVtq1 sJBjornr9KIB62nKrDLCj3NuILIUkXZ4wWbbMTWw5sgaJRZMNIDNrazeMdzQ+hMj7P HDbaPEd5UpLc2ode4clZ5W+zlRTmMTFr7Hd7mx0G/kPXR4cC8NR5YG2dIfYnvL87S9 GrIrFUuUJ12mmAdobqJA6v2IgKLsF+ysSLDicwC78vABI+AoyowwirI5NTzfn8fmLE Q5SShJnhhgFZQRZI4JSdwCqCLxlSSxr6EhupHFMclkxQVqnDyCf7xx5RBqPutdZg28 7HEfCp3ETk3pw== Message-ID: <4fb20b32-5651-4aff-9a4f-8db5652db476@kernel.org> Date: Fri, 22 May 2026 21:00:44 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, LKML , oliver.yang@linux.alibaba.com, syzbot+52bae5c495dbe261a0bc@syzkaller.appspotmail.com Subject: Re: [PATCH] erofs: fix use-after-free on sbi->sync_decompress To: Gao Xiang , linux-erofs@lists.ozlabs.org References: <20260522082716.3598160-1-hsiangkao@linux.alibaba.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20260522082716.3598160-1-hsiangkao@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: syzbot+52bae5c495dbe261a0bc@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=52bae5c495dbe261a0bc > Signed-off-by: Gao Xiang Reviewed-by: Chao Yu Thanks,