um: vector: Fix memory leak in vector_config
PATCH v2 1/1 um: vector: Fix memory leak in vector_config
kstrdup() return newly allocated copy of the string.
Call kfree() to release the memory when uml_parse_vector_ifspec() fails.
---
changes in v2:
- only call kfree() when uml_parse_vector_ifspec() fails.
--- arch/um/drivers/vector_kern.c | 1 + 1 file changed, 1 insertion(+)
arch/um/drivers/vector_kern.c +1 -0
@@ -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 ; }
Signature · 1 line
2.25.1
Quoted 17 lines · Miaoqian Lin
kstrdup()return newly allocated copy of the string.
Callkfree()to release the memory whenuml_parse_vector_ifspec()fails.Fixes 49da7e64f33e ("High Performance UML Vector Network Driver")Signed-off-by Miaoqian Lin <[email protected]>---
changes in v2:
- only callkfree()whenuml_parse_vector_ifspec()fails.--- arch/um/drivers/vector_kern.c | 1 + 1 file changed, 1 insertion(+)arch/um/drivers/vector_kern.c +0
-0
arch/um/drivers/vector_kern.c static int vector_config(char *str, char **error_out) · line 773
Quoted 7 lines
arch/um/drivers/vector_kern.c +1
-0@@ -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 ; }
Signature · 3 lines
Anton R. Ivanov Cambridgegreys Limited. Registered in England. Company Number 10273661 https://www.cambridgegreys.com/
Quoted 8 lines · Miaoqian Lin
kstrdup()return newly allocated copy of the string.
Callkfree()to release the memory whenuml_parse_vector_ifspec()fails.Fixes 49da7e64f33e ("High Performance UML Vector Network Driver")Signed-off-by Miaoqian Lin <[email protected]>---
changes in v2:
- only callkfree()whenuml_parse_vector_ifspec()fails.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds