From: Chris Mi Date: Tue, 8 Dec 2020 02:48:35 +0000 (+0800) Subject: net: flow_offload: Fix memory leak for indirect flow block X-Git-Tag: v5.10.7~1029^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5137d303659d8c324e67814b1cc2e1bc0c0d9836;p=platform%2Fkernel%2Flinux-rpi.git net: flow_offload: Fix memory leak for indirect flow block The offending commit introduces a cleanup callback that is invoked when the driver module is removed to clean up the tunnel device flow block. But it returns on the first iteration of the for loop. The remaining indirect flow blocks will never be freed. Fixes: 1fac52da5942 ("net: flow_offload: consolidate indirect flow_block infrastructure") CC: Pablo Neira Ayuso Signed-off-by: Chris Mi Reviewed-by: Roi Dayan --- diff --git a/net/core/flow_offload.c b/net/core/flow_offload.c index d4474c8..715b67f 100644 --- a/net/core/flow_offload.c +++ b/net/core/flow_offload.c @@ -381,10 +381,8 @@ static void __flow_block_indr_cleanup(void (*release)(void *cb_priv), list_for_each_entry_safe(this, next, &flow_block_indr_list, indr.list) { if (this->release == release && - this->indr.cb_priv == cb_priv) { + this->indr.cb_priv == cb_priv) list_move(&this->indr.list, cleanup_list); - return; - } } }