Skip to content

Commit 26d3dad

Browse files
Ronnie SahlbergSteve French
authored andcommitted
cifs: do not use uninitialized data in the owner/group sid
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 <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent dd5a927 commit 26d3dad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/cifs/cifsacl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
12971297

12981298
if (uid_valid(uid)) { /* chown */
12991299
uid_t id;
1300-
nowner_sid_ptr = kmalloc(sizeof(struct cifs_sid),
1300+
nowner_sid_ptr = kzalloc(sizeof(struct cifs_sid),
13011301
GFP_KERNEL);
13021302
if (!nowner_sid_ptr) {
13031303
rc = -ENOMEM;
@@ -1326,7 +1326,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
13261326
}
13271327
if (gid_valid(gid)) { /* chgrp */
13281328
gid_t id;
1329-
ngroup_sid_ptr = kmalloc(sizeof(struct cifs_sid),
1329+
ngroup_sid_ptr = kzalloc(sizeof(struct cifs_sid),
13301330
GFP_KERNEL);
13311331
if (!ngroup_sid_ptr) {
13321332
rc = -ENOMEM;

0 commit comments

Comments
 (0)