linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] avc: remove unnecessary pointer reassignment
@ 2015-02-26 21:54 Jeff Vander Stoep
  2015-02-26 22:08 ` Nick Kralevich
  2015-02-27 13:15 ` Stephen Smalley
  0 siblings, 2 replies; 5+ messages in thread
From: Jeff Vander Stoep @ 2015-02-26 21:54 UTC (permalink / raw)
  To: jvanderstoep
  Cc: Jeff Vander Stoep, Paul Moore, Stephen Smalley, Eric Paris,
	James Morris, Serge E. Hallyn, selinux, linux-security-module,
	linux-kernel

Commit f01e1af445fa ("selinux: don't pass in NULL avd to avc_has_perm_noaudit")
made this pointer reassignment unnecessary. Avd should continue to reference
the stack-based copy.

Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
---
 security/selinux/avc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index afcc0ae..3c17dda 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -724,12 +724,10 @@ inline int avc_has_perm_noaudit(u32 ssid, u32 tsid,
 	rcu_read_lock();
 
 	node = avc_lookup(ssid, tsid, tclass);
-	if (unlikely(!node)) {
+	if (unlikely(!node))
 		node = avc_compute_av(ssid, tsid, tclass, avd);
-	} else {
+	else
 		memcpy(avd, &node->ae.avd, sizeof(*avd));
-		avd = &node->ae.avd;
-	}
 
 	denied = requested & ~(avd->allowed);
 	if (unlikely(denied))
-- 
2.2.0.rc0.207.ga3a616c


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

* Re: [PATCH] avc: remove unnecessary pointer reassignment
  2015-02-26 21:54 [PATCH] avc: remove unnecessary pointer reassignment Jeff Vander Stoep
@ 2015-02-26 22:08 ` Nick Kralevich
  2015-02-27 13:15 ` Stephen Smalley
  1 sibling, 0 replies; 5+ messages in thread
From: Nick Kralevich @ 2015-02-26 22:08 UTC (permalink / raw)
  To: Jeff Vander Stoep
  Cc: Jeffrey Vander Stoep, lkml, linux-security-module, James Morris,
	Stephen Smalley, SELinux

Acked-By: Nick Kralevich <nnk@google.com>

On Thu, Feb 26, 2015 at 1:54 PM, Jeff Vander Stoep <jeffv@google.com> wrote:
> Commit f01e1af445fa ("selinux: don't pass in NULL avd to avc_has_perm_noaudit")
> made this pointer reassignment unnecessary. Avd should continue to reference
> the stack-based copy.
>
> Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
> ---
>  security/selinux/avc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/security/selinux/avc.c b/security/selinux/avc.c
> index afcc0ae..3c17dda 100644
> --- a/security/selinux/avc.c
> +++ b/security/selinux/avc.c
> @@ -724,12 +724,10 @@ inline int avc_has_perm_noaudit(u32 ssid, u32 tsid,
>         rcu_read_lock();
>
>         node = avc_lookup(ssid, tsid, tclass);
> -       if (unlikely(!node)) {
> +       if (unlikely(!node))
>                 node = avc_compute_av(ssid, tsid, tclass, avd);
> -       } else {
> +       else
>                 memcpy(avd, &node->ae.avd, sizeof(*avd));
> -               avd = &node->ae.avd;
> -       }
>
>         denied = requested & ~(avd->allowed);
>         if (unlikely(denied))
> --
> 2.2.0.rc0.207.ga3a616c
>
> _______________________________________________
> Selinux mailing list
> Selinux@tycho.nsa.gov
> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
> To get help, send an email containing "help" to Selinux-request@tycho.nsa.gov.



-- 
Nick Kralevich | Android Security | nnk@google.com | 650.214.4037

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

* Re: [PATCH] avc: remove unnecessary pointer reassignment
  2015-02-26 21:54 [PATCH] avc: remove unnecessary pointer reassignment Jeff Vander Stoep
  2015-02-26 22:08 ` Nick Kralevich
@ 2015-02-27 13:15 ` Stephen Smalley
  2015-03-04 18:07   ` Paul Moore
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Smalley @ 2015-02-27 13:15 UTC (permalink / raw)
  To: Jeff Vander Stoep, jvanderstoep
  Cc: linux-kernel, linux-security-module, James Morris, selinux,
	Paul Moore, Eric Paris

On 02/26/2015 04:54 PM, Jeff Vander Stoep wrote:
> Commit f01e1af445fa ("selinux: don't pass in NULL avd to avc_has_perm_noaudit")
> made this pointer reassignment unnecessary. Avd should continue to reference
> the stack-based copy.
> 
> Signed-off-by: Jeff Vander Stoep <jeffv@google.com>

Acked-by:  Stephen Smalley <sds@tycho.nsa.gov>

> ---
>  security/selinux/avc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/security/selinux/avc.c b/security/selinux/avc.c
> index afcc0ae..3c17dda 100644
> --- a/security/selinux/avc.c
> +++ b/security/selinux/avc.c
> @@ -724,12 +724,10 @@ inline int avc_has_perm_noaudit(u32 ssid, u32 tsid,
>  	rcu_read_lock();
>  
>  	node = avc_lookup(ssid, tsid, tclass);
> -	if (unlikely(!node)) {
> +	if (unlikely(!node))
>  		node = avc_compute_av(ssid, tsid, tclass, avd);
> -	} else {
> +	else
>  		memcpy(avd, &node->ae.avd, sizeof(*avd));
> -		avd = &node->ae.avd;
> -	}
>  
>  	denied = requested & ~(avd->allowed);
>  	if (unlikely(denied))
> 


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

* Re: [PATCH] avc: remove unnecessary pointer reassignment
  2015-02-27 13:15 ` Stephen Smalley
@ 2015-03-04 18:07   ` Paul Moore
  2015-03-09 19:34     ` Paul Moore
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Moore @ 2015-03-04 18:07 UTC (permalink / raw)
  To: Stephen Smalley
  Cc: Jeff Vander Stoep, jvanderstoep, linux-kernel,
	linux-security-module, James Morris, selinux, Eric Paris

On Fri, Feb 27, 2015 at 8:15 AM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
> On 02/26/2015 04:54 PM, Jeff Vander Stoep wrote:
>> Commit f01e1af445fa ("selinux: don't pass in NULL avd to avc_has_perm_noaudit")
>> made this pointer reassignment unnecessary. Avd should continue to reference
>> the stack-based copy.
>>
>> Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
>
> Acked-by:  Stephen Smalley <sds@tycho.nsa.gov>


Thanks everyone for the patch and the review.  I'll merge this next
week into selinux#next.

>> ---
>>  security/selinux/avc.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/security/selinux/avc.c b/security/selinux/avc.c
>> index afcc0ae..3c17dda 100644
>> --- a/security/selinux/avc.c
>> +++ b/security/selinux/avc.c
>> @@ -724,12 +724,10 @@ inline int avc_has_perm_noaudit(u32 ssid, u32 tsid,
>>       rcu_read_lock();
>>
>>       node = avc_lookup(ssid, tsid, tclass);
>> -     if (unlikely(!node)) {
>> +     if (unlikely(!node))
>>               node = avc_compute_av(ssid, tsid, tclass, avd);
>> -     } else {
>> +     else
>>               memcpy(avd, &node->ae.avd, sizeof(*avd));
>> -             avd = &node->ae.avd;
>> -     }
>>
>>       denied = requested & ~(avd->allowed);
>>       if (unlikely(denied))
>>
>



-- 
paul moore
www.paul-moore.com

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

* Re: [PATCH] avc: remove unnecessary pointer reassignment
  2015-03-04 18:07   ` Paul Moore
@ 2015-03-09 19:34     ` Paul Moore
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Moore @ 2015-03-09 19:34 UTC (permalink / raw)
  To: Stephen Smalley
  Cc: Jeff Vander Stoep, jvanderstoep, linux-kernel,
	linux-security-module, James Morris, selinux, Eric Paris

On Wed, Mar 4, 2015 at 1:07 PM, Paul Moore <paul@paul-moore.com> wrote:
> On Fri, Feb 27, 2015 at 8:15 AM, Stephen Smalley <sds@tycho.nsa.gov> wrote:
>> On 02/26/2015 04:54 PM, Jeff Vander Stoep wrote:
>>> Commit f01e1af445fa ("selinux: don't pass in NULL avd to avc_has_perm_noaudit")
>>> made this pointer reassignment unnecessary. Avd should continue to reference
>>> the stack-based copy.
>>>
>>> Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
>>
>> Acked-by:  Stephen Smalley <sds@tycho.nsa.gov>
>
> Thanks everyone for the patch and the review.  I'll merge this next
> week into selinux#next.

I apologize for the delay, but I just merged this into selinux#next;
it should be in the next linux-next kernel.

-- 
paul moore
www.paul-moore.com

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

end of thread, other threads:[~2015-03-09 19:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-26 21:54 [PATCH] avc: remove unnecessary pointer reassignment Jeff Vander Stoep
2015-02-26 22:08 ` Nick Kralevich
2015-02-27 13:15 ` Stephen Smalley
2015-03-04 18:07   ` Paul Moore
2015-03-09 19:34     ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).