Skip to content

Commit

Permalink
cifs: do not use uninitialized data in the owner/group sid
Browse files Browse the repository at this point in the history
When idsfromsid is used we create a special SID for owner/group.
This structure must be initialized or else the first 5 bytes
of the Authority field of the SID will contain uninitialized data
and thus not be a valid SID.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
  • Loading branch information
Ronnie Sahlberg authored and Steve French committed Feb 13, 2022
1 parent dd5a927 commit 26d3dad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/cifs/cifsacl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,

if (uid_valid(uid)) { /* chown */
uid_t id;
nowner_sid_ptr = kmalloc(sizeof(struct cifs_sid),
nowner_sid_ptr = kzalloc(sizeof(struct cifs_sid),
GFP_KERNEL);
if (!nowner_sid_ptr) {
rc = -ENOMEM;
Expand Down Expand Up @@ -1326,7 +1326,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
}
if (gid_valid(gid)) { /* chgrp */
gid_t id;
ngroup_sid_ptr = kmalloc(sizeof(struct cifs_sid),
ngroup_sid_ptr = kzalloc(sizeof(struct cifs_sid),
GFP_KERNEL);
if (!ngroup_sid_ptr) {
rc = -ENOMEM;
Expand Down

0 comments on commit 26d3dad

Please sign in to comment.