All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] um: vector: Fix memory leak in vector_config
@ 2022-11-15  7:32 ` Xiang Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Xiang Yang @ 2022-11-15  7:32 UTC (permalink / raw)
  To: patchwork, xiangyang3, kuba, richard, anton.ivanov, johannes
  Cc: linux-um, linux-kernel

If the return value of the uml_parse_vector_ifspec function is NULL,
we should call kfree(params) to prevent memory leak.

Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver")
Signed-off-by: Xiang Yang <xiangyang3@huawei.com>
---
 arch/um/drivers/vector_kern.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
index ded7c47d2fbe..131b7cb29576 100644
--- a/arch/um/drivers/vector_kern.c
+++ b/arch/um/drivers/vector_kern.c
@@ -767,6 +767,7 @@ static int vector_config(char *str, char **error_out)
 
 	if (parsed == NULL) {
 		*error_out = "vector_config failed to parse parameters";
+		kfree(params);
 		return -EINVAL;
 	}
 
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH -next] um: vector: Fix memory leak in vector_config
@ 2022-11-15  7:32 ` Xiang Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Xiang Yang @ 2022-11-15  7:32 UTC (permalink / raw)
  To: patchwork, xiangyang3, kuba, richard, anton.ivanov, johannes
  Cc: linux-um, linux-kernel

If the return value of the uml_parse_vector_ifspec function is NULL,
we should call kfree(params) to prevent memory leak.

Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver")
Signed-off-by: Xiang Yang <xiangyang3@huawei.com>
---
 arch/um/drivers/vector_kern.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
index ded7c47d2fbe..131b7cb29576 100644
--- a/arch/um/drivers/vector_kern.c
+++ b/arch/um/drivers/vector_kern.c
@@ -767,6 +767,7 @@ static int vector_config(char *str, char **error_out)
 
 	if (parsed == NULL) {
 		*error_out = "vector_config failed to parse parameters";
+		kfree(params);
 		return -EINVAL;
 	}
 
-- 
2.22.0


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] um: vector: Fix memory leak in vector_config
  2022-11-15  7:32 ` Xiang Yang
@ 2022-11-16 16:09   ` Anton Ivanov
  -1 siblings, 0 replies; 4+ messages in thread
From: Anton Ivanov @ 2022-11-16 16:09 UTC (permalink / raw)
  To: Xiang Yang, patchwork, kuba, richard, johannes; +Cc: linux-um, linux-kernel



On 15/11/2022 07:32, Xiang Yang wrote:
> If the return value of the uml_parse_vector_ifspec function is NULL,
> we should call kfree(params) to prevent memory leak.
> 
> Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver")
> Signed-off-by: Xiang Yang <xiangyang3@huawei.com>
> ---
>   arch/um/drivers/vector_kern.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
> index ded7c47d2fbe..131b7cb29576 100644
> --- a/arch/um/drivers/vector_kern.c
> +++ b/arch/um/drivers/vector_kern.c
> @@ -767,6 +767,7 @@ static int vector_config(char *str, char **error_out)
>   
>   	if (parsed == NULL) {
>   		*error_out = "vector_config failed to parse parameters";
> +		kfree(params);
>   		return -EINVAL;
>   	}
>   

Acked-By: Anton Ivanov <anton.ivanov@kot-begemot.co.uk>
-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] um: vector: Fix memory leak in vector_config
@ 2022-11-16 16:09   ` Anton Ivanov
  0 siblings, 0 replies; 4+ messages in thread
From: Anton Ivanov @ 2022-11-16 16:09 UTC (permalink / raw)
  To: Xiang Yang, patchwork, kuba, richard, johannes; +Cc: linux-um, linux-kernel



On 15/11/2022 07:32, Xiang Yang wrote:
> If the return value of the uml_parse_vector_ifspec function is NULL,
> we should call kfree(params) to prevent memory leak.
> 
> Fixes: 49da7e64f33e ("High Performance UML Vector Network Driver")
> Signed-off-by: Xiang Yang <xiangyang3@huawei.com>
> ---
>   arch/um/drivers/vector_kern.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
> index ded7c47d2fbe..131b7cb29576 100644
> --- a/arch/um/drivers/vector_kern.c
> +++ b/arch/um/drivers/vector_kern.c
> @@ -767,6 +767,7 @@ static int vector_config(char *str, char **error_out)
>   
>   	if (parsed == NULL) {
>   		*error_out = "vector_config failed to parse parameters";
> +		kfree(params);
>   		return -EINVAL;
>   	}
>   

Acked-By: Anton Ivanov <anton.ivanov@kot-begemot.co.uk>
-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/

_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-16 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15  7:32 [PATCH -next] um: vector: Fix memory leak in vector_config Xiang Yang
2022-11-15  7:32 ` Xiang Yang
2022-11-16 16:09 ` Anton Ivanov
2022-11-16 16:09   ` Anton Ivanov

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.