Skip to contentSkip to conversation

: Fix lookup logic of netlbl_domhsh_search_def.

PATCH Applied Pavel Emelyanov 3 participants 3 messages Feb 12, 2008 – Feb 13, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : 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).

---

net/netlabel/netlabel_domainhash.c +3 -3
index 9a8ea01..fd46231 100644
@@ -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;
 }
 
 /*
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Pavel Emelyanov

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

Good catch, thanks.

Quoted 22 lines

---

(quoted diff) +0 -0

b/net/netlabel/netlabel_domainhash.c index 9a8ea01..fd46231 100644

net/netlabel/netlabel_domainhash.c +3 -3
@@ -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;
 }
 

/*

Signature · 2 lines
paul moore
linux security @ hp