diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-08-11 04:25:00 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-08-11 04:25:00 +0200 |
commit | 4d9c73f60efe7a76f086bc93f7ef22be9d78bed6 (patch) | |
tree | 93b7ac2c680ea20dff76b23623606554a4b434e1 | |
parent | PM / Driver Core: Kill dev_pm_ops platform warning for now (diff) | |
parent | SELinux: fix memory leakage in /security/selinux/hooks.c (diff) | |
download | linux-4d9c73f60efe7a76f086bc93f7ef22be9d78bed6.tar.xz linux-4d9c73f60efe7a76f086bc93f7ef22be9d78bed6.zip |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6:
SELinux: fix memory leakage in /security/selinux/hooks.c
-rw-r--r-- | security/selinux/hooks.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 15c2a08a66f1..1e8cfc4c2ed6 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -1285,6 +1285,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, context, len); if (rc == -ERANGE) { + kfree(context); + /* Need a larger buffer. Query for the right size. */ rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, NULL, 0); @@ -1292,7 +1294,6 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent dput(dentry); goto out_unlock; } - kfree(context); len = rc; context = kmalloc(len+1, GFP_NOFS); if (!context) { |