For -mm only - inode_getsecurity rework
Subsystems (2)
Casey Schaufler
maintainerPATCH 1/1 For -mm only - inode_getsecurity rework
From: Casey Schaufler <[email protected]>
This represents the rework required for changes to inode_getsecurity. It is relative to smack24rc2v11, which is the version added to -mm, but subsequently removed because of the change to inode_getsecurity
Signed-off-by Casey Schaufler <[email protected]>
---
security/smack/smack_lsm.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
security/smack/smack_lsm.c +4 -8
@@ -673,8 +673,8 @@ static int smack_inode_removexattr(struc* Returns the size of the attribute or an error code */ static int smack_inode_getsecurity (const struct inode *inode, -const char *name,void *buffer, -size_t size,int err) +const char *name,void **buffer, +bool alloc) {struct socket_smack *ssp;struct socket *sock;
@@ -687,9 +687,7 @@ static int smack_inode_getsecurity(constif (strcmp (name,XATTR_SMACK_SUFFIX ) ==0 ) { isp =smk_of_inode (inode); ilen =strlen (isp) +1 ; -if (ilen > size) -return -EINVAL ; -strncpy (buffer, isp, ilen); + *buffer = isp;return ilen; }
@@ -714,10 +712,8 @@ static int smack_inode_getsecurity(constreturn -EOPNOTSUPP ; ilen =strlen (isp) +1 ; -if (ilen > size) - rc = -EINVAL ;if (rc ==0 ) { -strncpy (buffer, isp, ilen); + *buffer = isp; rc = ilen; }