Skip to content

Commit a562826

Browse files
committed
smb3: fix possible access to uninitialized pointer to DACL
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 <[email protected]>
1 parent 0917310 commit a562826

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/cifs/cifsacl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
12941294
ndacl_ptr = (struct cifs_acl *)((char *)pnntsd + ndacloffset);
12951295
ndacl_ptr->revision =
12961296
dacloffset ? dacl_ptr->revision : cpu_to_le16(ACL_REVISION);
1297-
ndacl_ptr->num_aces = dacl_ptr->num_aces;
1297+
ndacl_ptr->num_aces = dacl_ptr ? dacl_ptr->num_aces : 0;
12981298

12991299
if (uid_valid(uid)) { /* chown */
13001300
uid_t id;

0 commit comments

Comments
 (0)