From: Bin Lan <bin.lan.cn@windriver.com>
To: <gregkh@linuxfoundation.org>, <stable@vger.kernel.org>
Subject: [PATCH 6.1] fs/ntfs3: Additional check in ntfs_file_release
Date: Mon, 18 Nov 2024 10:26:50 +0800 [thread overview]
Message-ID: <20241118022650.558385-1-bin.lan.cn@windriver.com> (raw)
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
[ Upstream commit 031d6f608290c847ba6378322d0986d08d1a645a ]
Reported-by: syzbot+8c652f14a0fde76ff11d@syzkaller.appspotmail.com
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Bin Lan <bin.lan.cn@windriver.com>
---
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
WARNING: multiple messages have this Message-ID (diff)
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Bin Lan <bin.lan.cn@windriver.com>, Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH 6.1] fs/ntfs3: Additional check in ntfs_file_release
Date: Sun, 17 Nov 2024 21:48:40 -0500 [thread overview]
Message-ID: <20241118022650.558385-1-bin.lan.cn@windriver.com> (raw)
Message-ID: <20241118024840.2HG75p-gMVQkylVrktYqHLuZzTGhPGVfaO01bxZgsKI@z> (raw)
In-Reply-To: <20241118022650.558385-1-bin.lan.cn@windriver.com>
[ 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 <bin.lan.cn@windriver.com>
Commit author: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
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 <almaz.alexandrovich@paragon-software.com>
+Signed-off-by: Bin Lan <bin.lan.cn@windriver.com>
---
- 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 |
next reply other threads:[~2024-11-18 2:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 2:26 Bin Lan [this message]
2024-11-18 2:48 ` [PATCH 6.1] fs/ntfs3: Additional check in ntfs_file_release Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241118022650.558385-1-bin.lan.cn@windriver.com \
--to=bin.lan.cn@windriver.com \
--cc=gregkh@linuxfoundation.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox