diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-08-10 22:25:00 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-08-10 22:25:00 -0400 |
| commit | 4d9c73f60efe7a76f086bc93f7ef22be9d78bed6 (patch) | |
| tree | 93b7ac2c680ea20dff76b23623606554a4b434e1 /security/selinux/hooks.c | |
| parent | 651b1f125c7e3806bbd635739d009433dc07372d (diff) | |
| parent | 314dabb83a547ec4da819e8cbc78fac9cec605cd (diff) | |
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
Diffstat (limited to '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 | |||
| 1285 | rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, | 1285 | rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, |
| 1286 | context, len); | 1286 | context, len); |
| 1287 | if (rc == -ERANGE) { | 1287 | if (rc == -ERANGE) { |
| 1288 | kfree(context); | ||
| 1289 | |||
| 1288 | /* Need a larger buffer. Query for the right size. */ | 1290 | /* Need a larger buffer. Query for the right size. */ |
| 1289 | rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, | 1291 | rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, |
| 1290 | NULL, 0); | 1292 | NULL, 0); |
| @@ -1292,7 +1294,6 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
| 1292 | dput(dentry); | 1294 | dput(dentry); |
| 1293 | goto out_unlock; | 1295 | goto out_unlock; |
| 1294 | } | 1296 | } |
| 1295 | kfree(context); | ||
| 1296 | len = rc; | 1297 | len = rc; |
| 1297 | context = kmalloc(len+1, GFP_NOFS); | 1298 | context = kmalloc(len+1, GFP_NOFS); |
| 1298 | if (!context) { | 1299 | if (!context) { |
