All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Greg Kroah-Hartman <gregkh@suse.de>
Cc: <linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	sds@tycho.nsa.gov, jmorris@namei.org, casey@schaufler-ca.com,
	linux-security-module@vger.kernel.org
Subject: Re: [PATCH] sysfs: Don't leak secdata when a sysfs_dirent is freed.
Date: Wed, 04 Nov 2009 02:36:20 -0800	[thread overview]
Message-ID: <m1hbta4lwb.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <m13a4vdg7f.fsf@fess.ebiederm.org> (Eric W. Biederman's message of "Tue\, 03 Nov 2009 03\:02\:12 -0800")


Grr.  Please all ignore the 01/42 in the subject.  Clearly I was
a bit too tired when I sent this but the fix is good and fixes a bug
2.6.32-rc5 that should be there in the first place.


ebiederm@xmission.com (Eric W. Biederman) writes:

> 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>

> ---
>  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 5fad489..e020183 100644
> --- a/fs/sysfs/dir.c
> +++ b/fs/sysfs/dir.c
> @@ -21,6 +21,7 @@
>  #include <linux/completion.h>
>  #include <linux/mutex.h>
>  #include <linux/slab.h>
> +#include <linux/security.h>
>  #include "sysfs.h"
>  
>  DEFINE_MUTEX(sysfs_mutex);
> @@ -285,6 +286,9 @@ void release_sysfs_dirent(struct sysfs_dirent * sd)
>  		sysfs_put(sd->s_symlink.target_sd);
>  	if (sysfs_type(sd) & SYSFS_COPY_NAME)
>  		kfree(sd->s_name);
> +	if (sd->s_iattr && sd->s_iattr->ia_secdata)
> +		security_release_secctx(sd->s_iattr->ia_secdata,
> +					sd->s_iattr->ia_secdata_len);
>  	kfree(sd->s_iattr);
>  	sysfs_free_ino(sd->s_ino);
>  	kmem_cache_free(sysfs_dir_cachep, sd);
> -- 
> 1.6.5.2.143.g8cc62
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2009-11-04 10:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-03 11:02 [PATCH 01/42] sysfs: Don't leak secdata when a sysfs_dirent is freed Eric W. Biederman
2009-11-04 10:36 ` Eric W. Biederman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-11-04 10:50 [PATCH] " Eric W. Biederman
2009-11-04 14:09 ` Serge E. Hallyn
2009-11-04 14:26   ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1hbta4lwb.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=casey@schaufler-ca.com \
    --cc=gregkh@suse.de \
    --cc=jmorris@namei.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=sds@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.