Skip to content

Commit

Permalink
reiserfs: Initialize sec->length in reiserfs_security_init().
Browse files Browse the repository at this point in the history
syzbot is reporting that sec->length is not initialized.

Since security_inode_init_security() returns 0 when initxattrs is provided
but call_int_hook(inode_init_security) returned -EOPNOTSUPP, control will
reach to "if (sec->length && ...) {" without initializing sec->length.

Reported-by: syzbot <[email protected]>
Closes: https://syzkaller.appspot.com/bug?extid=00a3779539a23cbee38c
Signed-off-by: Tetsuo Handa <[email protected]>
Fixes: 52ca4b6 ("reiserfs: Switch to security_inode_init_security()")
Signed-off-by: Paul Moore <[email protected]>
  • Loading branch information
Tetsuo Handa authored and pcmoore committed May 25, 2023
1 parent a495108 commit d031f4e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/reiserfs/xattr_security.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ int reiserfs_security_init(struct inode *dir, struct inode *inode,

sec->name = NULL;
sec->value = NULL;
sec->length = 0;

/* Don't add selinux attributes on xattrs - they'll never get used */
if (IS_PRIVATE(dir))
Expand Down

0 comments on commit d031f4e

Please sign in to comment.