Skip to contentSkip to conversation

net: flow_offload: Fix memory leak for indirect flow block

PATCH Superseded Chris Mi 2 participants 3 messages Dec 7, 2020 – Dec 8, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chris Mi

author
#0 lore raw

PATCH 1/1 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")
---
 net/core/flow_offload.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
net/core/flow_offload.c +1 -3
index d4474c812b64..715b67f6c62f 100644
@@ -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;
-		}
 	}
 }
 
Signature · 1 line
2.26.2
maintainer
#1 lore raw
Quoted 8 lines · On Mon, 7 Dec 2020 09:59:16 +0800 Chris Mi wrote:

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

Please repost and CC relevant people.

author
#2 lore raw
Quoted 11 lines · Jakub Kicinski
Quoted 8 lines · On Mon, 7 Dec 2020 09:59:16 +0800 Chris Mi wrote:

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

Please repost and CC relevant people.

Done.