Skip to content

Commit

Permalink
smb3: fix possible access to uninitialized pointer to DACL
Browse files Browse the repository at this point in the history
[ Upstream commit a562826 ]

dacl_ptr can be null so we must check for it everywhere it is
used in build_sec_desc.

Addresses-Coverity: 1475598 ("Explicit null dereference")
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Steve French authored and gregkh committed Jul 14, 2021
1 parent 8c7bd6e commit c3bfad4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/cifs/cifsacl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
ndacl_ptr = (struct cifs_acl *)((char *)pnntsd + ndacloffset);
ndacl_ptr->revision =
dacloffset ? dacl_ptr->revision : cpu_to_le16(ACL_REVISION);
ndacl_ptr->num_aces = dacl_ptr->num_aces;
ndacl_ptr->num_aces = dacl_ptr ? dacl_ptr->num_aces : 0;

if (uid_valid(uid)) { /* chown */
uid_t id;
Expand Down

0 comments on commit c3bfad4

Please sign in to comment.