mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
cipso,calipso: resolve a number of problems with the DOI refcounts
commit ad5d07f4a9cd671233ae20983848874731102c08 upstream. The current CIPSO and CALIPSO refcounting scheme for the DOI definitions is a bit flawed in that we: 1. Don't correctly match gets/puts in netlbl_cipsov4_list(). 2. Decrement the refcount on each attempt to remove the DOI from the DOI list, only removing it from the list once the refcount drops to zero. This patch fixes these problems by adding the missing "puts" to netlbl_cipsov4_list() and introduces a more conventional, i.e. not-buggy, refcounting mechanism to the DOI definitions. Upon the addition of a DOI to the DOI list, it is initialized with a refcount of one, removing a DOI from the list removes it from the list and drops the refcount by one; "gets" and "puts" behave as expected with respect to refcounts, increasing and decreasing the DOI's refcount by one. Fixes:b1edeb1023("netlabel: Replace protocol/NetLabel linking with refrerence counts") Fixes:d7cce01504("netlabel: Add support for removing a CALIPSO DOI.") Reported-by: [email protected] Signed-off-by: Paul Moore <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
6d599697e9
commit
b4800e7a1c
3 changed files with 9 additions and 19 deletions
|
|
@ -575,6 +575,7 @@ list_start:
|
|||
|
||||
break;
|
||||
}
|
||||
cipso_v4_doi_putdef(doi_def);
|
||||
rcu_read_unlock();
|
||||
|
||||
genlmsg_end(ans_skb, data);
|
||||
|
|
@ -583,12 +584,14 @@ list_start:
|
|||
list_retry:
|
||||
/* XXX - this limit is a guesstimate */
|
||||
if (nlsze_mult < 4) {
|
||||
cipso_v4_doi_putdef(doi_def);
|
||||
rcu_read_unlock();
|
||||
kfree_skb(ans_skb);
|
||||
nlsze_mult *= 2;
|
||||
goto list_start;
|
||||
}
|
||||
list_failure_lock:
|
||||
cipso_v4_doi_putdef(doi_def);
|
||||
rcu_read_unlock();
|
||||
list_failure:
|
||||
kfree_skb(ans_skb);
|
||||
|
|
|
|||
Loading…
Reference in a new issue