Skip to content

Commit d0c15c1

Browse files
YueHaibinggregkh
authored andcommitted
dccp: Fix memleak in __feat_register_sp
commit 1d3ff09 upstream. 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]> Signed-off-by: Ben Hutchings <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent db1fb5a commit d0c15c1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

net/dccp/feat.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,12 @@ static int __feat_register_sp(struct list_head *fn, u8 feat, u8 is_local,
738738
if (dccp_feat_clone_sp_val(&fval, sp_val, sp_len))
739739
return -ENOMEM;
740740

741-
return dccp_feat_push_change(fn, feat, is_local, mandatory, &fval);
741+
if (dccp_feat_push_change(fn, feat, is_local, mandatory, &fval)) {
742+
kfree(fval.sp.vec);
743+
return -ENOMEM;
744+
}
745+
746+
return 0;
742747
}
743748

744749
/**

0 commit comments

Comments
 (0)