All of lore.kernel.org
 help / color / mirror / Atom feed
* selinux: fix uninitalised stack variable read in sel_netport_init
@ 2014-08-07 16:38 Dave Jones
  2014-08-08 13:02 ` Paul Moore
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Jones @ 2014-08-07 16:38 UTC (permalink / raw)
  To: Linux Kernel; +Cc: pmoore, jmorris

After the removal of the avc_add_callback() in commit 615e51fdda6
("selinux: reduce the number of calls to synchronize_net() when flushing caches"),
ret is never set to anything, but we return uninitialized stack data on success.

Given the absense of other failure paths, just explicitly return 0.

Signed-off-by: Dave Jones <davej@redhat.com>

diff --git a/security/selinux/netport.c b/security/selinux/netport.c
index 73ac6784d091..3311cc393cb4 100644
--- a/security/selinux/netport.c
+++ b/security/selinux/netport.c
@@ -237,7 +237,6 @@ void sel_netport_flush(void)
 static __init int sel_netport_init(void)
 {
 	int iter;
-	int ret;
 
 	if (!selinux_enabled)
 		return 0;
@@ -247,7 +246,7 @@ static __init int sel_netport_init(void)
 		sel_netport_hash[iter].size = 0;
 	}
 
-	return ret;
+	return 0;
 }
 
 __initcall(sel_netport_init);

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

* Re: selinux: fix uninitalised stack variable read in sel_netport_init
  2014-08-07 16:38 selinux: fix uninitalised stack variable read in sel_netport_init Dave Jones
@ 2014-08-08 13:02 ` Paul Moore
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Moore @ 2014-08-08 13:02 UTC (permalink / raw)
  To: Dave Jones; +Cc: Linux Kernel, jmorris

On Thursday, August 07, 2014 12:38:18 PM Dave Jones wrote:
> After the removal of the avc_add_callback() in commit 615e51fdda6
> ("selinux: reduce the number of calls to synchronize_net() when flushing
> caches"), ret is never set to anything, but we return uninitialized stack
> data on success.
> 
> Given the absense of other failure paths, just explicitly return 0.
> 
> Signed-off-by: Dave Jones <davej@redhat.com>

Thanks for the patch, but another more comprehensive patch (there are similar 
problems in netnode.c and netif.c) was posted earlier this week and reposted 
last night ... although evidently I need to send the patch(es) directly to 
Linus, so you'll likely see another repost in a few moments.

> diff --git a/security/selinux/netport.c b/security/selinux/netport.c
> index 73ac6784d091..3311cc393cb4 100644
> --- a/security/selinux/netport.c
> +++ b/security/selinux/netport.c
> @@ -237,7 +237,6 @@ void sel_netport_flush(void)
>  static __init int sel_netport_init(void)
>  {
>  	int iter;
> -	int ret;
> 
>  	if (!selinux_enabled)
>  		return 0;
> @@ -247,7 +246,7 @@ static __init int sel_netport_init(void)
>  		sel_netport_hash[iter].size = 0;
>  	}
> 
> -	return ret;
> +	return 0;
>  }
> 
>  __initcall(sel_netport_init);

-- 
paul moore
security and virtualization @ redhat


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

end of thread, other threads:[~2014-08-08 13:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-07 16:38 selinux: fix uninitalised stack variable read in sel_netport_init Dave Jones
2014-08-08 13:02 ` Paul Moore

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.