All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] SELinux: memory leak in selinux_sb_copy_data()
@ 2005-06-17 13:18 Gerald Schaefer
  2005-06-17 15:47 ` Gerald Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Gerald Schaefer @ 2005-06-17 13:18 UTC (permalink / raw)
  To: akpm; +Cc: jmorris, sds, schwidefsky, linux-kernel

[PATCH 1/1] SELinux: memory leak in selinux_sb_copy_data()
There is a memory leak during mount when SELinux is active and mount options
are specified.

Signed-off-by: Gerald Schaefer <geraldsc@de.ibm.com>
---

diff -pruN linux-2.6-git/security/selinux/hooks.c linux-2.6-git_xxx/security/selinux/hooks.c
--- linux-2.6-git/security/selinux/hooks.c      2005-06-16 20:01:03.000000000 +0200
+++ linux-2.6-git_xxx/security/selinux/hooks.c  2005-06-17 14:38:08.000000000 +0200
@@ -1945,6 +1945,7 @@ static int selinux_sb_copy_data(struct f
        } while (*in_end++);
 
        copy_page(in_save, nosec_save);
+       free_page((unsigned long)nosec);
 out:
        return rc;
 }



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] SELinux: memory leak in selinux_sb_copy_data()
  2005-06-17 13:18 [PATCH 1/1] SELinux: memory leak in selinux_sb_copy_data() Gerald Schaefer
@ 2005-06-17 15:47 ` Gerald Schaefer
  2005-06-17 15:57   ` Stephen Smalley
  0 siblings, 1 reply; 5+ messages in thread
From: Gerald Schaefer @ 2005-06-17 15:47 UTC (permalink / raw)
  To: akpm; +Cc: jmorris, sds, schwidefsky, linux-kernel

On Fri, 2005-06-17 at 15:18 +0200, Gerald Schaefer wrote:
> [PATCH 1/1] SELinux: memory leak in selinux_sb_copy_data()
> There is a memory leak during mount when SELinux is active and mount options
> are specified.
> 
> Signed-off-by: Gerald Schaefer <geraldsc@de.ibm.com>
> ---
> 
> diff -pruN linux-2.6-git/security/selinux/hooks.c linux-2.6-git_xxx/security/selinux/hooks.c
> --- linux-2.6-git/security/selinux/hooks.c      2005-06-16 20:01:03.000000000 +0200
> +++ linux-2.6-git_xxx/security/selinux/hooks.c  2005-06-17 14:38:08.000000000 +0200
> @@ -1945,6 +1945,7 @@ static int selinux_sb_copy_data(struct f
>         } while (*in_end++);
>  
>         copy_page(in_save, nosec_save);
> +       free_page((unsigned long)nosec);
>  out:
>         return rc;
>  }
> 

Sorry, there was a whitespace accident and the above patch would not
apply.
Here is the fixed version:

diff -pruN linux-2.6-git/security/selinux/hooks.c linux-2.6-git_xxx/security/selinux/hooks.c
--- linux-2.6-git/security/selinux/hooks.c	2005-06-16 20:01:03.000000000 +0200
+++ linux-2.6-git_xxx/security/selinux/hooks.c	2005-06-17 14:38:08.000000000 +0200
@@ -1945,6 +1945,7 @@ static int selinux_sb_copy_data(struct f
 	} while (*in_end++);
 
 	copy_page(in_save, nosec_save);
+	free_page((unsigned long)nosec);
 out:
 	return rc;
 }



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] SELinux: memory leak in selinux_sb_copy_data()
  2005-06-17 15:47 ` Gerald Schaefer
@ 2005-06-17 15:57   ` Stephen Smalley
  2005-06-17 16:18     ` Gerald Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Smalley @ 2005-06-17 15:57 UTC (permalink / raw)
  To: geraldsc; +Cc: akpm, jmorris, schwidefsky, linux-kernel

On Fri, 2005-06-17 at 17:47 +0200, Gerald Schaefer wrote:
> Sorry, there was a whitespace accident and the above patch would not
> apply.
> Here is the fixed version:
> 
> diff -pruN linux-2.6-git/security/selinux/hooks.c linux-2.6-git_xxx/security/selinux/hooks.c
> --- linux-2.6-git/security/selinux/hooks.c	2005-06-16 20:01:03.000000000 +0200
> +++ linux-2.6-git_xxx/security/selinux/hooks.c	2005-06-17 14:38:08.000000000 +0200
> @@ -1945,6 +1945,7 @@ static int selinux_sb_copy_data(struct f
>  	} while (*in_end++);
>  
>  	copy_page(in_save, nosec_save);
> +	free_page((unsigned long)nosec);
>  out:
>  	return rc;
>  }

Shouldn't that be nosec_save?  nosec is advanced by take_option().

-- 
Stephen Smalley
National Security Agency


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] SELinux: memory leak in selinux_sb_copy_data()
  2005-06-17 15:57   ` Stephen Smalley
@ 2005-06-17 16:18     ` Gerald Schaefer
  2005-06-17 17:33       ` Stephen Smalley
  0 siblings, 1 reply; 5+ messages in thread
From: Gerald Schaefer @ 2005-06-17 16:18 UTC (permalink / raw)
  To: Stephen Smalley; +Cc: akpm, jmorris, schwidefsky, linux-kernel

On Fri, 2005-06-17 at 11:57 -0400, Stephen Smalley wrote:
> 
> Shouldn't that be nosec_save?  nosec is advanced by take_option().
> 
That's right, I muddled that up. Hope I got this one-line patch right
this time...

diff -pruN linux-2.6-git/security/selinux/hooks.c linux-2.6-git_xxx/security/selinux/hooks.c
--- linux-2.6-git/security/selinux/hooks.c	2005-06-16 20:01:03.000000000 +0200
+++ linux-2.6-git_xxx/security/selinux/hooks.c	2005-06-17 14:38:08.000000000 +0200
@@ -1945,6 +1945,7 @@ static int selinux_sb_copy_data(struct f
 	} while (*in_end++);
 
 	copy_page(in_save, nosec_save);
+	free_page((unsigned long)nosec_save);
 out:
 	return rc;
 }


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] SELinux: memory leak in selinux_sb_copy_data()
  2005-06-17 16:18     ` Gerald Schaefer
@ 2005-06-17 17:33       ` Stephen Smalley
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Smalley @ 2005-06-17 17:33 UTC (permalink / raw)
  To: geraldsc; +Cc: akpm, jmorris, schwidefsky, linux-kernel

On Fri, 2005-06-17 at 18:18 +0200, Gerald Schaefer wrote:
> On Fri, 2005-06-17 at 11:57 -0400, Stephen Smalley wrote:
> > 
> > Shouldn't that be nosec_save?  nosec is advanced by take_option().
> > 
> That's right, I muddled that up. Hope I got this one-line patch right
> this time...
> 
> diff -pruN linux-2.6-git/security/selinux/hooks.c linux-2.6-git_xxx/security/selinux/hooks.c
> --- linux-2.6-git/security/selinux/hooks.c	2005-06-16 20:01:03.000000000 +0200
> +++ linux-2.6-git_xxx/security/selinux/hooks.c	2005-06-17 14:38:08.000000000 +0200
> @@ -1945,6 +1945,7 @@ static int selinux_sb_copy_data(struct f
>  	} while (*in_end++);
>  
>  	copy_page(in_save, nosec_save);
> +	free_page((unsigned long)nosec_save);
>  out:
>  	return rc;
>  }

Thanks, looks fine.

Acked-by:  Stephen Smalley <sds@epoch.ncsc.mil>

-- 
Stephen Smalley
National Security Agency


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-06-17 17:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-17 13:18 [PATCH 1/1] SELinux: memory leak in selinux_sb_copy_data() Gerald Schaefer
2005-06-17 15:47 ` Gerald Schaefer
2005-06-17 15:57   ` Stephen Smalley
2005-06-17 16:18     ` Gerald Schaefer
2005-06-17 17:33       ` Stephen Smalley

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.