diff options
author | Steve French <stfrench@microsoft.com> | 2021-06-23 00:54:50 +0200 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2021-06-24 02:26:40 +0200 |
commit | a5628263a9f8d47d9a1548fe9d5d75ba4423a735 (patch) | |
tree | c92046bc8bab44be82d32acb484e56c2392b9afb /fs/cifs/cifsacl.c | |
parent | cifs: missing null check for newinode pointer (diff) | |
download | linux-a5628263a9f8d47d9a1548fe9d5d75ba4423a735.tar.xz linux-a5628263a9f8d47d9a1548fe9d5d75ba4423a735.zip |
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 <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/cifsacl.c')
-rw-r--r-- | fs/cifs/cifsacl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index 5ec5d9d24032..388eb536cff1 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c @@ -1294,7 +1294,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; |