Skip to contentSkip to conversation

fs/ntfs3: uninitialized variable in ntfs_set_acl_ex()

PATCH In review Dan Carpenter 2 participants 2 messages Aug 8, 2022 – Aug 10, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/ntfs3: uninitialized variable in ntfs_set_acl_ex()

The goto out calls kfree(value) on an uninitialized pointer. Just return directly as the other error paths do.

Fixes 460bbf2990b3 ("fs/ntfs3: Do not change mode if ntfs_set_ea failed")
---
 fs/ntfs3/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/xattr.c +1 -1
index 02f6a933ee79..5bdff12a1232 100644
@@ -568,7 +568,7 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
 			err = posix_acl_update_mode(mnt_userns, inode, &mode,
 						    &acl);
 			if (err)
-				goto out;
+				return err;
 		}
 		name = XATTR_NAME_POSIX_ACL_ACCESS;
 		name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1;
Signature · 1 line
2.35.1
#1 lore raw
Quoted 14 lines · Dan Carpenter

The goto out calls kfree(value) on an uninitialized pointer. Just return directly as the other error paths do.

Fixes 460bbf2990b3 ("fs/ntfs3: Do not change mode if ntfs_set_ea failed")
---
  fs/ntfs3/xattr.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/xattr.c +0 -0
index 02f6a933ee79..5bdff12a1232 100644

fs/ntfs3/xattr.c static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns, · line 574

Quoted 8 lines
fs/ntfs3/xattr.c +1 -1
@@ -568,7 +568,7 @@ static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
  			err = posix_acl_update_mode(mnt_userns, inode, &mode,
  						    &acl);
  			if (err)
-				goto out;
+				return err;
  		}
  		name = XATTR_NAME_POSIX_ACL_ACCESS;
  		name_len = sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1;

Thanks for patch, applied!