mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
[IPSEC] flow: Fix potential memory leak
When old flow cache entries that are not at the head of their chain trigger a transient security error they get unlinked along with all the entries preceding them in the chain. The preceding entries are not freed correctly. This patch fixes this by simply leaving the entry around. It's based on a suggestion by Venkat Yekkirala. Signed-off-by: Herbert Xu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
419dd8378d
commit
e0e8f1c822
1 changed files with 10 additions and 16 deletions
|
|
@ -231,22 +231,16 @@ nocache:
|
|||
|
||||
err = resolver(key, family, dir, &obj, &obj_ref);
|
||||
|
||||
if (fle) {
|
||||
if (err) {
|
||||
/* Force security policy check on next lookup */
|
||||
*head = fle->next;
|
||||
flow_entry_kill(cpu, fle);
|
||||
} else {
|
||||
fle->genid = atomic_read(&flow_cache_genid);
|
||||
if (fle && !err) {
|
||||
fle->genid = atomic_read(&flow_cache_genid);
|
||||
|
||||
if (fle->object)
|
||||
atomic_dec(fle->object_ref);
|
||||
if (fle->object)
|
||||
atomic_dec(fle->object_ref);
|
||||
|
||||
fle->object = obj;
|
||||
fle->object_ref = obj_ref;
|
||||
if (obj)
|
||||
atomic_inc(fle->object_ref);
|
||||
}
|
||||
fle->object = obj;
|
||||
fle->object_ref = obj_ref;
|
||||
if (obj)
|
||||
atomic_inc(fle->object_ref);
|
||||
}
|
||||
local_bh_enable();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue