summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthan Tidmore <ethantidmore06@gmail.com>2026-02-26 19:09:06 +0300
committerNamjae Jeon <linkinjeon@kernel.org>2026-02-27 12:43:43 +0300
commitac9ccb6e75c5af84095bece1019f22cb45ab43e5 (patch)
treeae9251b50115f5ae0a5a9e38f74ee677db5c6d9b
parent1c85157ea88e87644e171c7ae3e1877f43b4b345 (diff)
downloadlinux-ac9ccb6e75c5af84095bece1019f22cb45ab43e5.tar.xz
ntfs: Fix possible deadlock
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'. Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com> Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
-rw-r--r--fs/ntfs/attrib.c4
1 files changed, 3 insertions, 1 deletions
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++)