Skip to contentSkip to conversation

fs/ntfs3: Fix general protection fault in run_is_mapped_full

PATCH In review Bin Lan 2 participants 2 messages Nov 14, 2024 – Nov 15, 2024 Stable branch

lore
Share & tools
lore

Bin Lan

author
#0 lore raw

PATCH 1/1 fs/ntfs3: Fix general protection fault in run_is_mapped_full

From: Konstantin Komarov <[email protected]>

[ Upstream commit a33fb016e49e37aafab18dc3c8314d6399cb4727 ]

Fixed deleating of a non-resident attribute in ntfs_create_inode() rollback.

---
 fs/ntfs3/inode.c | 9 +++++++++
 1 file changed, 9 insertions(+)
fs/ntfs3/inode.c +9 -0
index 026ed43c0670..8d1cfa0fc13f 100644
@@ -1646,6 +1646,15 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns,
 			  le16_to_cpu(new_de->key_size), sbi);
 	/* ni_unlock(dir_ni); will be called later. */
 out6:
+	attr = ni_find_attr(ni, NULL, NULL, ATTR_EA, NULL, 0, NULL, NULL);
+	if (attr && attr->non_res) {
+		/* Delete ATTR_EA, if non-resident. */
+		struct runs_tree run;
+		run_init(&run);
+		attr_set_size(ni, ATTR_EA, NULL, 0, &run, 0, NULL, false, NULL);
+		run_close(&run);
+	}
+	
 	if (rp_inserted)
 		ntfs_remove_reparse(sbi, IO_REPARSE_TAG_SYMLINK, &new_de->ref);
 
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 21 lines · Bin Lan

From: Konstantin Komarov <[email protected]>

[ Upstream commit a33fb016e49e37aafab18dc3c8314d6399cb4727 ]

Fixed deleating of a non-resident attribute in ntfs_create_inode() rollback.

---
 fs/ntfs3/inode.c | 9 +++++++++
 1 file changed, 9 insertions(+)
fs/ntfs3/inode.c +0 -0
index 026ed43c0670..8d1cfa0fc13f 100644
@@ -1646,6 +1646,15 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns,
 			  le16_to_cpu(new_de->key_size), sbi);
 	/* ni_unlock(dir_ni); will be called later. */

fs/ntfs3/inode.c struct inode *ntfs_create_inode(struct user_namespace *mnt_userns, · line 1657

Quoted 10 lines
fs/ntfs3/inode.c +9 -0
 out6:
+	attr = ni_find_attr(ni, NULL, NULL, ATTR_EA, NULL, 0, NULL, NULL);
+	if (attr && attr->non_res) {
+		/* Delete ATTR_EA, if non-resident. */
+		struct runs_tree run;
+		run_init(&run);
+		attr_set_size(ni, ATTR_EA, NULL, 0, &run, 0, NULL, false, NULL);
+		run_close(&run);
+	}
+	

You have trailing whitespace here :(