diff mbox series

[net] net: flow_offload: Fix memory leak for indirect flow block

Message ID 20201207015916.43126-1-cmi@nvidia.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net] net: flow_offload: Fix memory leak for indirect flow block | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Chris Mi Dec. 7, 2020, 1:59 a.m. UTC
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")
Signed-off-by: Chris Mi <cmi@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
---
 net/core/flow_offload.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Jakub Kicinski Dec. 8, 2020, 2:28 a.m. UTC | #1
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")
> Signed-off-by: Chris Mi <cmi@nvidia.com>
> Reviewed-by: Roi Dayan <roid@nvidia.com>

Please repost and CC relevant people.
Chris Mi Dec. 8, 2020, 2:49 a.m. UTC | #2
On 12/8/2020 10:28 AM, Jakub Kicinski wrote:
> 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")
>> Signed-off-by: Chris Mi <cmi@nvidia.com>
>> Reviewed-by: Roi Dayan <roid@nvidia.com>
> Please repost and CC relevant people.
>
Done.
diff mbox series

Patch

diff --git a/net/core/flow_offload.c b/net/core/flow_offload.c
index d4474c812b64..715b67f6c62f 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;
-		}
 	}
 }