public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ethan Tidmore <ethantidmore06@gmail.com>
To: linkinjeon@kernel.org, hyc.lee@gmail.com
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ethan Tidmore <ethantidmore06@gmail.com>
Subject: [PATCH 3/3] ntfs: Fix possible deadlock
Date: Thu, 26 Feb 2026 10:09:06 -0600	[thread overview]
Message-ID: <20260226160906.7175-4-ethantidmore06@gmail.com> (raw)
In-Reply-To: <20260226160906.7175-1-ethantidmore06@gmail.com>

In the error path for ntfs_attr_map_whole_runlist() the lock is not
released.

Add release for lock.

Detected by Smatch:
fs/ntfs/attrib.c:5197 ntfs_non_resident_attr_collapse_range() warn:
inconsistent returns '&ni->runlist.lock'.

Fixes: 495e90fa33482 ("ntfs: update attrib operations")
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
 fs/ntfs/attrib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
index 71ad870eceac..2af45df2aab1 100644
--- a/fs/ntfs/attrib.c
+++ b/fs/ntfs/attrib.c
@@ -5124,8 +5124,10 @@ int ntfs_non_resident_attr_collapse_range(struct ntfs_inode *ni, s64 start_vcn,
 
 	down_write(&ni->runlist.lock);
 	ret = ntfs_attr_map_whole_runlist(ni);
-	if (ret)
+	if (ret) {
+		up_write(&ni->runlist.lock);
 		return ret;
+	}
 
 	len = min(len, end_vcn - start_vcn);
 	for (rl = ni->runlist.rl, dst_cnt = 0; rl && rl->length; rl++)
-- 
2.53.0


  parent reply	other threads:[~2026-02-26 16:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26 16:09 [PATCH 0/3] ntfs: Bug fixes for attrib.c Ethan Tidmore
2026-02-26 16:09 ` [PATCH 1/3] ntfs: Place check before dereference Ethan Tidmore
2026-02-27  2:32   ` Hyunchul Lee
2026-02-26 16:09 ` [PATCH 2/3] ntfs: Add missing error code Ethan Tidmore
2026-02-27  2:37   ` Hyunchul Lee
2026-02-26 16:09 ` Ethan Tidmore [this message]
2026-02-27  2:38   ` [PATCH 3/3] ntfs: Fix possible deadlock Hyunchul Lee
2026-02-27  9:44 ` [PATCH 0/3] ntfs: Bug fixes for attrib.c Namjae Jeon

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=20260226160906.7175-4-ethantidmore06@gmail.com \
    --to=ethantidmore06@gmail.com \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@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