[PATCH] smack inode_listsecurity fix

From: Casey Schaufler
Date: Wed Oct 29 2008 - 11:16:31 EST


From: Casey Schaufler <casey@xxxxxxxxxxxxxxxx>

This patch fixes the problem known by "tmpfs support of xattrs?"
which is in fact the result of a bad implementation of the
inode_listsecurity LSM hook in Smack. Thanks to Stephen Smalley,
who identified the problem and all but coded the fix before I'd
even heard about it.

Signed-off-by: Casey Schaufler <casey@xxxxxxxxxxxxxxxx>

---

security/smack/smack_lsm.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff -uprN -X linux-2.6/Documentation/dontdiff linux-2.6/security/smack/smack_lsm.c linux-smack/security/smack/smack_lsm.c
--- linux-2.6/security/smack/smack_lsm.c 2008-10-26 17:37:08.000000000 -0700
+++ linux-smack/security/smack/smack_lsm.c 2008-10-26 19:11:23.000000000 -0700
@@ -763,13 +763,11 @@ static int smack_inode_getsecurity(const
static int smack_inode_listsecurity(struct inode *inode, char *buffer,
size_t buffer_size)
{
- int len = strlen(XATTR_NAME_SMACK);
+ int len = sizeof(XATTR_NAME_SMACK);

- if (buffer != NULL && len <= buffer_size) {
+ if (buffer != NULL && len <= buffer_size)
memcpy(buffer, XATTR_NAME_SMACK, len);
- return len;
- }
- return -EINVAL;
+ return len;
}

/**



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/