diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2009-11-04 05:50:06 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-11-04 16:19:18 -0500 |
commit | 4c3da2209b1261af9a948b7509a38904c8eee554 (patch) | |
tree | 74e2f113f8a40885b0df4858a3ba19f4747086a1 | |
parent | 91d3f9bacdb4950d2f79fe2ba296aa249f60d06c (diff) |
sysfs: Don't leak secdata when a sysfs_dirent is freed.
While refreshing my sysfs patches I noticed a leak in the secdata
implementation. We don't free the secdata when we free the
sysfs dirent.
This is a bug in 2.6.32-rc5 that we really should close.
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
-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); |