From: Casey Schaufler <casey@schaufler-ca.com>
To: akpm@osdl.org, torvalds@osdl.org
Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] For -mm only - inode_getsecurity rework
Date: Wed, 14 Nov 2007 08:11:57 -0800 [thread overview]
Message-ID: <473B1E4D.40800@schaufler-ca.com> (raw)
From: Casey Schaufler <casey@schaufler-ca.com>
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 <casey@schaufler-ca.com>
---
security/smack/smack_lsm.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff -uprN -X linux-2.6.24-rc2-base/Documentation/dontdiff linux-2.6.24-rc2-smack/security/smack/smack_lsm.c linux-2.6.24-rc2-mm1-smack/security/smack/smack_lsm.c
--- linux-2.6.24-rc2-smack/security/smack/smack_lsm.c 2007-11-07 21:35:41.000000000 -0800
+++ linux-2.6.24-rc2-mm1-smack/security/smack/smack_lsm.c 2007-11-12 22:49:16.000000000 -0800
@@ -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(const
if (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(const
return -EOPNOTSUPP;
ilen = strlen(isp) + 1;
- if (ilen > size)
- rc = -EINVAL;
if (rc == 0) {
- strncpy(buffer, isp, ilen);
+ *buffer = isp;
rc = ilen;
}
reply other threads:[~2007-11-14 16:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=473B1E4D.40800@schaufler-ca.com \
--to=casey@schaufler-ca.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox