diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-11-05 13:57:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-11-05 13:57:39 -0500 |
commit | d4116f820496ae3af5225d09450edc7791df0045 (patch) | |
tree | 54205739d4e65788757882fdda5dbd9687d93966 /fs | |
parent | 608221fdf9a2170962295dcfbea53dc5c50d1a74 (diff) | |
parent | 4c3da2209b1261af9a948b7509a38904c8eee554 (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:
sysfs: Don't leak secdata when a sysfs_dirent is freed.
Diffstat (limited to 'fs')
-rw-r--r-- | fs/sysfs/dir.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 5fad489ce5bc..e0201837d244 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/completion.h> | 21 | #include <linux/completion.h> |
22 | #include <linux/mutex.h> | 22 | #include <linux/mutex.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/security.h> | ||
24 | #include "sysfs.h" | 25 | #include "sysfs.h" |
25 | 26 | ||
26 | DEFINE_MUTEX(sysfs_mutex); | 27 | DEFINE_MUTEX(sysfs_mutex); |
@@ -285,6 +286,9 @@ void release_sysfs_dirent(struct sysfs_dirent * sd) | |||
285 | sysfs_put(sd->s_symlink.target_sd); | 286 | sysfs_put(sd->s_symlink.target_sd); |
286 | if (sysfs_type(sd) & SYSFS_COPY_NAME) | 287 | if (sysfs_type(sd) & SYSFS_COPY_NAME) |
287 | kfree(sd->s_name); | 288 | kfree(sd->s_name); |
289 | if (sd->s_iattr && sd->s_iattr->ia_secdata) | ||
290 | security_release_secctx(sd->s_iattr->ia_secdata, | ||
291 | sd->s_iattr->ia_secdata_len); | ||
288 | kfree(sd->s_iattr); | 292 | kfree(sd->s_iattr); |
289 | sysfs_free_ino(sd->s_ino); | 293 | sysfs_free_ino(sd->s_ino); |
290 | kmem_cache_free(sysfs_dir_cachep, sd); | 294 | kmem_cache_free(sysfs_dir_cachep, sd); |