Commit 4c3a0a254e5d706d3fe01bf42261534858d05586

Authored by Pavel Emelyanov
Committed by David S. Miller
1 parent 0f8f27c395

[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>

Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff

net/netlabel/netlabel_domainhash.c
... ... @@ -150,11 +150,11 @@
150 150 entry = netlbl_domhsh_search(domain);
151 151 if (entry == NULL) {
152 152 entry = rcu_dereference(netlbl_domhsh_def);
153   - if (entry != NULL && entry->valid)
154   - return entry;
  153 + if (entry != NULL && !entry->valid)
  154 + entry = NULL;
155 155 }
156 156  
157   - return NULL;
  157 + return entry;
158 158 }
159 159  
160 160 /*