Skip to content

Commit

Permalink
dccp: Fix memleak in __feat_register_sp
Browse files Browse the repository at this point in the history
If dccp_feat_push_change fails, we forget free the mem
which is alloced by kmemdup in dccp_feat_clone_sp_val.

Reported-by: Hulk Robot <[email protected]>
Fixes: e8ef967 ("dccp: Registration routines for changing feature values")
Reviewed-by: Mukesh Ojha <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
YueHaibing authored and davem330 committed Apr 2, 2019
1 parent 09279e6 commit 1d3ff09
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/dccp/feat.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,12 @@ static int __feat_register_sp(struct list_head *fn, u8 feat, u8 is_local,
if (dccp_feat_clone_sp_val(&fval, sp_val, sp_len))
return -ENOMEM;

return dccp_feat_push_change(fn, feat, is_local, mandatory, &fval);
if (dccp_feat_push_change(fn, feat, is_local, mandatory, &fval)) {
kfree(fval.sp.vec);
return -ENOMEM;
}

return 0;
}

/**
Expand Down

0 comments on commit 1d3ff09

Please sign in to comment.