SELinux: memory leak in selinux_sb_copy_data()
PATCH 1/1 SELinux: memory leak in selinux_sb_copy_data()
[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.
---
security/selinux/hooks.c 2005-06-17 14:38:08.000000000 +0200 renamed from security/selinux/hooks.c 2005-06-16 20:01:03.000000000 +0200 +1 -0
@@ -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; }
Quoted 12 lines · Gerald Schaefer
[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 <[email protected]>---
diff -pruN
linux-2.6-git/security/selinux/hooks.clinux-2.6-git_xxx/security/selinux/hooks.c
security/selinux/hooks.c 2005-06-17 14:38:08.000000000 +0200 static int selinux_sb_copy_data(struct f · line 1951
Quoted 7 lines
security/selinux/hooks.c 2005-06-17 14:38:08.000000000 +0200 renamed from security/selinux/hooks.c 2005-06-16 20:01:03.000000000 +0200 +1
-0@@ -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:
security/selinux/hooks.c +1 -0
@@ -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; }
Quoted 8 lines · Gerald Schaefer
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.clinux-2.6-git_xxx/security/selinux/hooks.c
security/selinux/hooks.c static int selinux_sb_copy_data(struct f · line 1951
Quoted 7 lines
security/selinux/hooks.c +1
-0@@ -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().
Signature · 2 lines
Stephen Smalley National Security Agency
Quoted 3 lines · Stephen Smalley
Shouldn't that be
nosec_save? nosec is advanced bytake_option().
That's right, I muddled that up. Hope I got this one-line patch right this time...
security/selinux/hooks.c +1 -0
@@ -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; }
Stephen Smalley
Acked-byQuoted 11 lines · Gerald Schaefer
Quoted 3 lines · Stephen Smalley
Shouldn't that be
nosec_save? nosec is advanced bytake_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.clinux-2.6-git_xxx/security/selinux/hooks.c
security/selinux/hooks.c static int selinux_sb_copy_data(struct f · line 1951
Quoted 7 lines
security/selinux/hooks.c +1
-0@@ -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.
Signature · 2 lines
Stephen Smalley National Security Agency