Dan reported that acl is dereferenced before being checked and this is a
valid problem. Fix it be erroring out early instead of doing it later after
we've already relied on acl to be a valid pointer.
Fixes: dc1af4c4b472 ("cifs: implement set acl method")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
rc = PTR_ERR(full_path);
goto out;
}
+
+ if (!acl)
+ goto out;
+
/* return dos attributes as pseudo xattr */
/* return alt name if available as pseudo attr */
switch (type) {
case ACL_TYPE_ACCESS:
- if (!acl)
- goto out;
if (sb->s_flags & SB_POSIXACL)
rc = cifs_do_set_acl(xid, pTcon, full_path, acl,
ACL_TYPE_ACCESS,
break;
case ACL_TYPE_DEFAULT:
- if (!acl)
- goto out;
if (sb->s_flags & SB_POSIXACL)
rc = cifs_do_set_acl(xid, pTcon, full_path, acl,
ACL_TYPE_DEFAULT,