Skip to content

Commit

Permalink
security: cap_inode_getsecctx returning garbage
Browse files Browse the repository at this point in the history
We shouldn't be returning success from this function without also
filling in the return values ctx and ctxlen.

Note currently this doesn't appear to cause bugs since the only
inode_getsecctx caller I can find is fs/sysfs/inode.c, which only calls
this if security_inode_setsecurity succeeds.  Assuming
security_inode_setsecurity is set to cap_inode_setsecurity whenever
inode_getsecctx is set to cap_inode_getsecctx, this function can never
actually called.

So I noticed this only because the server labeled NFS patches add a real
caller.

Acked-by: Serge E. Hallyn <[email protected]>
Signed-off-by: J. Bruce Fields <[email protected]>
  • Loading branch information
J. Bruce Fields committed May 13, 2013
1 parent 4f540e2 commit 0d422af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion security/capability.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ static int cap_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen)

static int cap_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen)
{
return 0;
return -EOPNOTSUPP;
}
#ifdef CONFIG_KEYS
static int cap_key_alloc(struct key *key, const struct cred *cred,
Expand Down

0 comments on commit 0d422af

Please sign in to comment.