* Re: [MPTCP] [PATCH mptcp] net: mptcp: fix memory leak in case slab allocation fails
@ 2019-05-14 16:10 Matthieu Baerts
0 siblings, 0 replies; 4+ messages in thread
From: Matthieu Baerts @ 2019-05-14 16:10 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 1039 bytes --]
Hi Davide, Mat,
Thank you for the fix and the review!
On 14/05/2019 09:59, Davide Caratti wrote:
> On Mon, 2019-05-13 at 16:36 -0700, Mat Martineau wrote:
>> On Mon, 13 May 2019, Davide Caratti wrote:
>>
>>> slab_name is allocated, but not freed, when slab allocation fails: ensure
>>> it is freed in the error path of kmem_cache_create(...). While at it, fix
>>> reverse christmas tree in subflow_ops-init() local variable declarations.
>>
>> Davide -
>>
> Thanks for the leak fix. Looks good to me.
>
> hi Mat, thanks a lot for reviewing.
> I forgot to mention, this can be squashed into
> aedec94346fb ("mptcp: Create SUBFLOW socket for incoming connections").
Just did as requested:
- Squash: c45d94e6a43d81af6ebead98d9eaa070cbbeedc8
- Signed-off: 959b71909d14072cf0bfbb38a642b7a87a53244a
Cheers,
Matt
> regards,
>
--
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [MPTCP] [PATCH mptcp] net: mptcp: fix memory leak in case slab allocation fails
@ 2019-05-14 7:59 Davide Caratti
0 siblings, 0 replies; 4+ messages in thread
From: Davide Caratti @ 2019-05-14 7:59 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 595 bytes --]
On Mon, 2019-05-13 at 16:36 -0700, Mat Martineau wrote:
> On Mon, 13 May 2019, Davide Caratti wrote:
>
> > slab_name is allocated, but not freed, when slab allocation fails: ensure
> > it is freed in the error path of kmem_cache_create(...). While at it, fix
> > reverse christmas tree in subflow_ops-init() local variable declarations.
>
> Davide -
>
Thanks for the leak fix. Looks good to me.
hi Mat, thanks a lot for reviewing.
I forgot to mention, this can be squashed into
aedec94346fb ("mptcp: Create SUBFLOW socket for incoming connections").
regards,
--
davide
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [MPTCP] [PATCH mptcp] net: mptcp: fix memory leak in case slab allocation fails
@ 2019-05-13 23:36 Mat Martineau
0 siblings, 0 replies; 4+ messages in thread
From: Mat Martineau @ 2019-05-13 23:36 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 1577 bytes --]
On Mon, 13 May 2019, Davide Caratti wrote:
> slab_name is allocated, but not freed, when slab allocation fails: ensure
> it is freed in the error path of kmem_cache_create(...). While at it, fix
> reverse christmas tree in subflow_ops-init() local variable declarations.
Davide -
Thanks for the leak fix. Looks good to me.
Mat
>
> Fixes: aedec94346fb ("mptcp: Create SUBFLOW socket for incoming connections")
> Signed-off-by: Davide Caratti <dcaratti(a)redhat.com>
> ---
> net/mptcp/subflow.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> index e72492bfb5a7..032424c61ba9 100644
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
> @@ -269,8 +269,8 @@ static struct tcp_ulp_ops subflow_ulp_ops __read_mostly = {
> static int subflow_ops_init(struct request_sock_ops *subflow_ops)
> {
> subflow_ops->obj_size = sizeof(struct subflow_request_sock);
> - subflow_ops->slab = NULL;
> subflow_ops->slab_name = NULL;
> + subflow_ops->slab = NULL;
>
> subflow_ops->slab_name = kasprintf(GFP_KERNEL, "request_sock_subflow");
> if (!subflow_ops->slab_name)
> @@ -283,6 +283,7 @@ static int subflow_ops_init(struct request_sock_ops *subflow_ops)
> NULL);
>
> if (!subflow_ops->slab) {
> + kfree(subflow_ops->slab_name);
> return -ENOMEM;
> }
>
> --
> 2.20.1
>
> _______________________________________________
> mptcp mailing list
> mptcp(a)lists.01.org
> https://lists.01.org/mailman/listinfo/mptcp
>
--
Mat Martineau
Intel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [MPTCP] [PATCH mptcp] net: mptcp: fix memory leak in case slab allocation fails
@ 2019-05-13 16:55 Davide Caratti
0 siblings, 0 replies; 4+ messages in thread
From: Davide Caratti @ 2019-05-13 16:55 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 1234 bytes --]
slab_name is allocated, but not freed, when slab allocation fails: ensure
it is freed in the error path of kmem_cache_create(...). While at it, fix
reverse christmas tree in subflow_ops-init() local variable declarations.
Fixes: aedec94346fb ("mptcp: Create SUBFLOW socket for incoming connections")
Signed-off-by: Davide Caratti <dcaratti(a)redhat.com>
---
net/mptcp/subflow.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index e72492bfb5a7..032424c61ba9 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -269,8 +269,8 @@ static struct tcp_ulp_ops subflow_ulp_ops __read_mostly = {
static int subflow_ops_init(struct request_sock_ops *subflow_ops)
{
subflow_ops->obj_size = sizeof(struct subflow_request_sock);
- subflow_ops->slab = NULL;
subflow_ops->slab_name = NULL;
+ subflow_ops->slab = NULL;
subflow_ops->slab_name = kasprintf(GFP_KERNEL, "request_sock_subflow");
if (!subflow_ops->slab_name)
@@ -283,6 +283,7 @@ static int subflow_ops_init(struct request_sock_ops *subflow_ops)
NULL);
if (!subflow_ops->slab) {
+ kfree(subflow_ops->slab_name);
return -ENOMEM;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-14 16:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-14 16:10 [MPTCP] [PATCH mptcp] net: mptcp: fix memory leak in case slab allocation fails Matthieu Baerts
-- strict thread matches above, loose matches on Subject: below --
2019-05-14 7:59 Davide Caratti
2019-05-13 23:36 Mat Martineau
2019-05-13 16:55 Davide Caratti
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.