From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) (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 C1A3330C16E for ; Wed, 20 May 2026 06:36:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.132 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779258996; cv=none; b=q15Gx7a8itqFGM9+ouNSiFTbOLuhUbo/Rcv1hUkr6nEXBrEXYDIYuuGELddai8T/McQ0N3y4HSKASm6iCBmg4knC5LCSYhFBREPaRQNfXu3L3WThcCA/YfBQZwJ9MD3U6r8G+fYBeJHYzZitjyTFtv1zBFA8QHpgloDECjyCiKM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779258996; c=relaxed/simple; bh=Ui86rfMTG5OvfhxyWeOPvlFYbPIiagJNNV0lZXfsjyU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hgNQvwdsZvjvTLoKvpOWSyctasJx5pRtzXVxbl8olVwNCUr8sNWobReWmkdtvcPVKcftTcRmZajtRfbRFEHx5uVVMKJ1njzJQnmyQA88xjjcOxgpKanBpbiouZrkAwsuu6zRjgQ0cEe7vO/dce6h2JRIsYVVoDzy1U5EkdIbcoA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=QOuYtuk6; arc=none smtp.client-ip=115.124.30.132 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="QOuYtuk6" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1779258988; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=5dh5i7z1bpxiBcX7pyprUm5C8cR79plwwq0Zm3WDNQ0=; b=QOuYtuk6PWZqw1bQzWBnQfL6leRsnWOC3m5zZ8YRvTCSs0gKufU2dW9k2dkZs/TxBL1pO5XU64kDCsBn6OaBsI4LxKGLw0KUHor2AUBYgfVo8P9QaJRb3/a3xfNT8qKu2rRzxMEbtonGdq1ktVo5Z0yZIaAqsgCdZTtcgY1YeH4= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037026112;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0X3HewgN_1779258986; Received: from 30.221.132.121(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0X3HewgN_1779258986 cluster:ay36) by smtp.aliyun-inc.com; Wed, 20 May 2026 14:36:27 +0800 Message-ID: Date: Wed, 20 May 2026 14:36:25 +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 Subject: Re: [PATCH v2] erofs: fix metabuf leak in inode xattr initialization To: Jia Zhu , Gao Xiang , Chao Yu Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, Yue Hu , Jeffle Xu , Sandeep Dhavale , Hongbo Li , Chunhai Guo , Amir Goldstein References: <20260520034252.40163-1-zhujia.zj@bytedance.com> <20260520044607.50992-1-zhujia.zj@bytedance.com> From: Gao Xiang In-Reply-To: <20260520044607.50992-1-zhujia.zj@bytedance.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2026/5/20 12:46, Jia Zhu wrote: > commit bb88e8da0025 ("erofs: use meta buffers for xattr operations") > converted xattr operations to use on-stack erofs_buf instances. > erofs_init_inode_xattrs() uses such a metabuf while reading the inline > xattr header and shared xattr id array. > > Some error paths after erofs_read_metabuf() leave through out_unlock > without dropping the metabuf, so the folio reference can leak. > > Consolidate the cleanup at out_unlock. erofs_put_metabuf() is a > no-op if no folio has been acquired, and this keeps all paths after > taking EROFS_I_BL_XATTR_BIT covered by a single cleanup site. > > Fixes: bb88e8da0025 ("erofs: use meta buffers for xattr operations") > Useless new line, I will remove this line manually when applying. > Signed-off-by: Jia Zhu Reviewed-by: Gao Xiang Thanks, Gao Xiang