* [PATCH v3] dccp: Fix memleak in __feat_register_sp
@ 2019-03-25 2:41 Yue Haibing
2019-03-25 3:44 ` David Miller
2019-03-27 14:55 ` Mukesh Ojha
0 siblings, 2 replies; 3+ messages in thread
From: Yue Haibing @ 2019-03-25 2:41 UTC (permalink / raw)
To: davem, gerrit; +Cc: linux-kernel, netdev, dccp, mojha, YueHaibing
From: YueHaibing <yuehaibing@huawei.com>
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 <hulkci@huawei.com>
Fixes: e8ef967a54f4 ("dccp: Registration routines for changing feature values")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
v3: fix compile issue, sorry for this again
v2: kfree 'val --> 'fval'
---
net/dccp/feat.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/dccp/feat.c b/net/dccp/feat.c
index f227f00..db87d9f 100644
--- a/net/dccp/feat.c
+++ b/net/dccp/feat.c
@@ -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;
}
/**
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] dccp: Fix memleak in __feat_register_sp
2019-03-25 2:41 [PATCH v3] dccp: Fix memleak in __feat_register_sp Yue Haibing
@ 2019-03-25 3:44 ` David Miller
2019-03-27 14:55 ` Mukesh Ojha
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-03-25 3:44 UTC (permalink / raw)
To: yuehaibing; +Cc: gerrit, linux-kernel, netdev, dccp, mojha
I said DO NOT submit any networking patches for at least 2 days, and yet
you still posted a followup to this?
Please don't. I'm ignoring all of your submissions for at least 2 days.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] dccp: Fix memleak in __feat_register_sp
2019-03-25 2:41 [PATCH v3] dccp: Fix memleak in __feat_register_sp Yue Haibing
2019-03-25 3:44 ` David Miller
@ 2019-03-27 14:55 ` Mukesh Ojha
1 sibling, 0 replies; 3+ messages in thread
From: Mukesh Ojha @ 2019-03-27 14:55 UTC (permalink / raw)
To: Yue Haibing, davem, gerrit; +Cc: linux-kernel, netdev, dccp
On 3/25/2019 8:11 AM, Yue Haibing wrote:
> From: YueHaibing <yuehaibing@huawei.com>
>
> 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 <hulkci@huawei.com>
> Fixes: e8ef967a54f4 ("dccp: Registration routines for changing feature values")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
-Mukesh
> ---
> v3: fix compile issue, sorry for this again
> v2: kfree 'val --> 'fval'
> ---
> net/dccp/feat.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/net/dccp/feat.c b/net/dccp/feat.c
> index f227f00..db87d9f 100644
> --- a/net/dccp/feat.c
> +++ b/net/dccp/feat.c
> @@ -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;
> }
>
> /**
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-27 14:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-25 2:41 [PATCH v3] dccp: Fix memleak in __feat_register_sp Yue Haibing
2019-03-25 3:44 ` David Miller
2019-03-27 14:55 ` Mukesh Ojha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome