[NETLABEL]: Fix lookup logic of netlbl_domhsh_search_def.

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <git-commits-head@...>
Date: Friday, February 15, 2008 - 6:00 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4c3a0a...
Commit:     4c3a0a254e5d706d3fe01bf42261534858d05586
Parent:     0f8f27c39553dd3aedcaf5c39adefe3efef28b6b
Author:     Pavel Emelyanov <xemul@openvz.org>
AuthorDate: Tue Feb 12 22:15:14 2008 -0800
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Tue Feb 12 22:15:14 2008 -0800

    [NETLABEL]: Fix lookup logic of netlbl_domhsh_search_def.
    
    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>
    Acked-by: Paul Moore <paul.moore@hp.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/netlabel/netlabel_domainhash.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

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;
 }
 
 /*
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[NETLABEL]: Fix lookup logic of netlbl_domhsh_search_def., Linux Kernel Mailing List..., (Fri Feb 15, 6:00 pm)