netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][NETLABEL]: Fix lookup logic of netlbl_domhsh_search_def.
@ 2008-02-12 16:27 Pavel Emelyanov
  2008-02-12 16:34 ` Paul Moore
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Emelyanov @ 2008-02-12 16:27 UTC (permalink / raw)
  To: David Miller; +Cc: Paul Moore, Linux Netdev List

Currently, if the call to netlbl_domhsh_search succeeds the
return result will still be NULL.

Fix that, by returning the found entry (if any).

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c
index 9a8ea01..fd46231 100644
--- a/net/netlabel/netlabel_domainhash.c
+++ b/net/netlabel/netlabel_domainhash.c
@@ -150,11 +150,11 @@ static struct netlbl_dom_map *netlbl_domhsh_search_def(const char *domain)
 	entry = netlbl_domhsh_search(domain);
 	if (entry == NULL) {
 		entry = rcu_dereference(netlbl_domhsh_def);
-		if (entry != NULL && entry->valid)
-			return entry;
+		if (entry != NULL && !entry->valid)
+			entry = NULL;
 	}
 
-	return NULL;
+	return entry;
 }
 
 /*

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

* Re: [PATCH][NETLABEL]: Fix lookup logic of netlbl_domhsh_search_def.
  2008-02-12 16:27 [PATCH][NETLABEL]: Fix lookup logic of netlbl_domhsh_search_def Pavel Emelyanov
@ 2008-02-12 16:34 ` Paul Moore
  2008-02-13  6:15   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Moore @ 2008-02-12 16:34 UTC (permalink / raw)
  To: Pavel Emelyanov; +Cc: David Miller, Linux Netdev List

On Tuesday 12 February 2008 11:27:16 am Pavel Emelyanov wrote:
> Currently, if the call to netlbl_domhsh_search succeeds the
> return result will still be NULL.
>
> Fix that, by returning the found entry (if any).
>
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Good catch, thanks.

Acked-by: Paul Moore <paul.moore@hp.com>

> ---
>
> diff --git a/net/netlabel/netlabel_domainhash.c
> b/net/netlabel/netlabel_domainhash.c index 9a8ea01..fd46231 100644
> --- a/net/netlabel/netlabel_domainhash.c
> +++ b/net/netlabel/netlabel_domainhash.c
> @@ -150,11 +150,11 @@ static struct netlbl_dom_map
> *netlbl_domhsh_search_def(const char *domain) entry =
> netlbl_domhsh_search(domain);
>  	if (entry == NULL) {
>  		entry = rcu_dereference(netlbl_domhsh_def);
> -		if (entry != NULL && entry->valid)
> -			return entry;
> +		if (entry != NULL && !entry->valid)
> +			entry = NULL;
>  	}
>
> -	return NULL;
> +	return entry;
>  }
>
>  /*

-- 
paul moore
linux security @ hp

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

* Re: [PATCH][NETLABEL]: Fix lookup logic of netlbl_domhsh_search_def.
  2008-02-12 16:34 ` Paul Moore
@ 2008-02-13  6:15   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2008-02-13  6:15 UTC (permalink / raw)
  To: paul.moore; +Cc: xemul, netdev

From: Paul Moore <paul.moore@hp.com>
Date: Tue, 12 Feb 2008 11:34:09 -0500

> On Tuesday 12 February 2008 11:27:16 am Pavel Emelyanov wrote:
> > Currently, if the call to netlbl_domhsh_search succeeds the
> > return result will still be NULL.
> >
> > Fix that, by returning the found entry (if any).
> >
> > Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
> 
> Good catch, thanks.
> 
> Acked-by: Paul Moore <paul.moore@hp.com>

Applied, thanks everyone.

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

end of thread, other threads:[~2008-02-13  6:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-12 16:27 [PATCH][NETLABEL]: Fix lookup logic of netlbl_domhsh_search_def Pavel Emelyanov
2008-02-12 16:34 ` Paul Moore
2008-02-13  6:15   ` David Miller

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