From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) (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 86D33360 for ; Mon, 18 Nov 2024 02:26:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.166.238 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731896799; cv=none; b=eLxKkpSypVmAw2K5zp2j1G7TBVAbAjJPl29edng7FWcsp1OcaPNIK4lYdazTFJH5zE5sueBQgky0m0XvCThjxwWa22tgVE/9rirzFnz80YfdOwDpb8qYhOFn3zJirQp1cBsVCM89BAv0fJsxup7jD1ye3CB5dAcpO+ZnmFtBxpI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731896799; c=relaxed/simple; bh=TXn4y5juGEPBgwUxkcoJFh3/fXqGLIrnAAh6BseMT/M=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=QWXQBBD2Av5Wfpn8o8WNFp+PWOFfW+NFXCMbz3KrsdWBjst4M/UibWd5jr6V9T3ioyAlrqunWmQkDhtCSym5MB5n01x92dfh92lSQ0goBX2tSU1GTX2no/pfbNwXIMREofeA9S1lmBQkIBlkvHo/kqu+AFQwfhDiEBsfzr9fsvQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com; spf=pass smtp.mailfrom=windriver.com; arc=none smtp.client-ip=205.220.166.238 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4AI1SRKC027004; Sun, 17 Nov 2024 18:26:30 -0800 Received: from ala-exchng01.corp.ad.wrs.com (ala-exchng01.wrs.com [147.11.82.252]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 42xqj7s3xr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Sun, 17 Nov 2024 18:26:29 -0800 (PST) Received: from ala-exchng01.corp.ad.wrs.com (147.11.82.252) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Sun, 17 Nov 2024 18:26:29 -0800 Received: from pek-blan-cn-d1.wrs.com (128.224.34.185) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server id 15.1.2507.43 via Frontend Transport; Sun, 17 Nov 2024 18:26:28 -0800 From: Bin Lan To: , Subject: [PATCH 6.1] fs/ntfs3: Additional check in ntfs_file_release Date: Mon, 18 Nov 2024 10:26:50 +0800 Message-ID: <20241118022650.558385-1-bin.lan.cn@windriver.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: WBGNfDIgZLgYHqb3RVdV_xkXT1JWHZRW X-Proofpoint-GUID: WBGNfDIgZLgYHqb3RVdV_xkXT1JWHZRW X-Authority-Analysis: v=2.4 cv=Sb6ldeRu c=1 sm=1 tr=0 ts=673aa5d5 cx=c_pps a=/ZJR302f846pc/tyiSlYyQ==:117 a=/ZJR302f846pc/tyiSlYyQ==:17 a=VlfZXiiP6vEA:10 a=GFCt93a2AAAA:8 a=hSkVLCK3AAAA:8 a=t7CeM3EgAAAA:8 a=2DXtWoY0YfVhbeZ-LxUA:9 a=0UNspqPZPZo5crgNHNjb:22 a=cQPPKAXgyycSBL8etih5:22 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-17_24,2024-11-14_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 spamscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 adultscore=0 phishscore=0 mlxscore=0 bulkscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.21.0-2409260000 definitions=main-2411180020 From: Konstantin Komarov [ Upstream commit 031d6f608290c847ba6378322d0986d08d1a645a ] Reported-by: syzbot+8c652f14a0fde76ff11d@syzkaller.appspotmail.com Signed-off-by: Konstantin Komarov Signed-off-by: Bin Lan --- fs/ntfs3/file.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index aedd4f5f459e..70b38465aee3 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -1214,8 +1214,16 @@ static int ntfs_file_release(struct inode *inode, struct file *file) int err = 0; /* If we are last writer on the inode, drop the block reservation. */ - if (sbi->options->prealloc && ((file->f_mode & FMODE_WRITE) && - atomic_read(&inode->i_writecount) == 1)) { + if (sbi->options->prealloc && + ((file->f_mode & FMODE_WRITE) && + atomic_read(&inode->i_writecount) == 1) + /* + * The only file when inode->i_fop = &ntfs_file_operations and + * init_rwsem(&ni->file.run_lock) is not called explicitly is MFT. + * + * Add additional check here. + */ + && inode->i_ino != MFT_REC_MFT) { ni_lock(ni); down_write(&ni->file.run_lock); -- 2.43.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A2F4C43ABD for ; Mon, 18 Nov 2024 02:48:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731898130; cv=none; b=inXPxBWPo7LHPpruY4/DZkF0dOz5j1sGqOW7OoNvxHG9aRsjdbShHkPETxCn+VHZl14/JPqCpa467BJiGi4HsHBT1rLuhFDATPWE16c+vX3egG9K1R5wuMtfPBS47j3zVJUtP9HnyfWIpzQWWDxjk0KQIrv5JoQgqR8BRNJlyf4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731898130; c=relaxed/simple; bh=vfdLAguinJtQe1lTsV3ThzsSkjg83XwaaDaI2xsXTEg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XQ11J3KHQAaOaDAud5XNsCxExGGovEYlF9D03r7pzb5MhBedQz+nzs6wA14Y4R7+B7XulMN4KXxbUATtgEr2o6sAovOUTv7UlHIisS1yaRwmgPzQlxg6HSQ+sTvrehKemWxdwXcPSquhIoZUsEdTVnh9RR8U54Ruqy2AfN1sLoc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AbQiE8ln; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AbQiE8ln" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACACFC4CECD; Mon, 18 Nov 2024 02:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731898130; bh=vfdLAguinJtQe1lTsV3ThzsSkjg83XwaaDaI2xsXTEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AbQiE8lnwYDNLImBBX9F2GhCBGSgb4cM0paZVc/wfxDVd6k2/TkVVhqfbVZNzwbTG IpqBZZ56GEAE01Ql5fcqY6GjCuQuzopvgeTSVKFOIZC82vVq7vvVu/VSe4aWb5ZnOQ /30yTlTffchvu9w6xb1Q/6bNb6EvqZeqPGXU1duwdkt8VBCdi4pc0+J8C6fgrEKgdP k+irEYfsQYtcxAdPiYM/6NIRbHI0ibRl2x4KoR6eouKKmyxRJp/f/4n4n2yEQ0MNdH 1kDUsU3VeWNw6iJqLRAywp/2O2V3AFiAqEzAtWLJGld+0vmqfhos3MqaT+FFx7r6bz +0+CpLAX7zTcg== From: Sasha Levin To: stable@vger.kernel.org Cc: Bin Lan , Sasha Levin Subject: Re: [PATCH 6.1] fs/ntfs3: Additional check in ntfs_file_release Date: Sun, 17 Nov 2024 21:48:40 -0500 Message-ID: <20241118022650.558385-1-bin.lan.cn@windriver.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241118022650.558385-1-bin.lan.cn@windriver.com> References: Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: <20241118024840.2HG75p-gMVQkylVrktYqHLuZzTGhPGVfaO01bxZgsKI@z> [ Sasha's backport helper bot ] Hi, The upstream commit SHA1 provided is correct: 031d6f608290c847ba6378322d0986d08d1a645a WARNING: Author mismatch between patch and upstream commit: Backport author: Bin Lan Commit author: Konstantin Komarov Note: The patch differs from the upstream commit: --- --- - 2024-11-17 21:38:25.916310313 -0500 +++ /tmp/tmp.zOVCh2qWVm 2024-11-17 21:38:25.910015113 -0500 @@ -1,18 +1,24 @@ +[ Upstream commit 031d6f608290c847ba6378322d0986d08d1a645a ] + Reported-by: syzbot+8c652f14a0fde76ff11d@syzkaller.appspotmail.com Signed-off-by: Konstantin Komarov +Signed-off-by: Bin Lan --- - fs/ntfs3/file.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) + fs/ntfs3/file.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c -index 4fdcb5177ea17..eb935d4180c0a 100644 +index aedd4f5f459e..70b38465aee3 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c -@@ -1314,7 +1314,14 @@ static int ntfs_file_release(struct inode *inode, struct file *file) +@@ -1214,8 +1214,16 @@ static int ntfs_file_release(struct inode *inode, struct file *file) + int err = 0; + /* If we are last writer on the inode, drop the block reservation. */ - if (sbi->options->prealloc && - ((file->f_mode & FMODE_WRITE) && -- atomic_read(&inode->i_writecount) == 1)) { +- if (sbi->options->prealloc && ((file->f_mode & FMODE_WRITE) && +- atomic_read(&inode->i_writecount) == 1)) { ++ if (sbi->options->prealloc && ++ ((file->f_mode & FMODE_WRITE) && + atomic_read(&inode->i_writecount) == 1) + /* + * The only file when inode->i_fop = &ntfs_file_operations and @@ -24,3 +30,6 @@ ni_lock(ni); down_write(&ni->file.run_lock); +-- +2.43.0 + --- Results of testing on various branches: | Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.1.y | Success | Success |