arch: free dev before return
Subsystems (2)
PATCH 1/1 arch: free dev before return
We fixed a bug where the variable dev
was not freed before return.
--- arch/xtensa/platforms/iss/network.c | 1 + 1 file changed, 1 insertion(+)
arch/xtensa/platforms/iss/network.c +1 -0
@@ -540,6 +540,7 @@ static void iss_net_configure(int index, char *init)rtnl_unlock ();pr_err ("%s: error registering net device!\n" , dev->name);platform_device_unregister (&lp->pdev); +free_netdev (dev);return ; }rtnl_unlock ();
Signature · 1 line
2.39.0
Hi Minjie,
Quoted 8 lines · Minjie Du
We fixed a bug where the variable dev
was not freed before return.Signed-off-by Minjie Du <[email protected]>--- arch/xtensa/platforms/iss/network.c | 1 + 1 file changed, 1 insertion(+)
Applied to my xtensa tree with the following commit message:
xtensa: ISS: fix etherdev leak in error return path
iss_net_configure frees etherdev in all error return paths except one where register_netdevice fails. Add missing free_netdev to that path.
Signature · 2 lines
Thanks. -- Max
Max Filippov
maintainerQuoted 10 lines · Max Filippov
Quoted 8 lines · Minjie Du
We fixed a bug where the variable dev
was not freed before return.Signed-off-by Minjie Du <[email protected]>--- arch/xtensa/platforms/iss/network.c | 1 + 1 file changed, 1 insertion(+)
Quoted 7 lines
Applied to my xtensa tree with the following commit message:
xtensa: ISS: fix etherdev leak in error return path
iss_net_configurefrees etherdev in all error return paths except one whereregister_netdevicefails. Add missingfree_netdevto that path.
After testing it I realized that in that error return path the etherdev is freed by the iss_net_pdev_release callback and that this patch introduces freeing an active timer on that path. I've dropped this patch and committed another one that adds a comment about what's going on at that place.
Signature · 2 lines
Thanks. -- Max
A message that is not in the archive (sent off-list or not yet received): [email protected]
Max Filippov
maintainerRe: [PATCH] xtensa: ISS: fix etherdev leak in error return path
Quoted 10 lines · Markus Elfring
Quoted 3 lines
Quoted 3 lines
We fixed a bug where the variable dev
was not freed before return.…
Quoted 1 line
Quoted 1 line
arch/xtensa/platforms/iss/network.c | 1 +…
Quoted 4 lines
Applied to my xtensa tree with the following commit message:
xtensa: ISS: fix etherdev leak in error return path
Quoted 8 lines
Quoted 2 lines
iss_net_configurefrees etherdev in all error return paths except one whereregister_netdevicefails. Add missingfree_netdevto that path.* Did you add the tag “Fixes” because of the completed resource cleanup for the implementation of the function “iss_net_configure”?
* How do you think about to replace any statements by the source code “goto err_free_netdev;” here?
I've scrapped that patch and committed the other one instead. See
https://lore.kernel.org/lkml/CAMo8BfKe1nR+UP1WiUWFX0E7GSEfHsF8bZapsUYu3NFTnA8_AQ@mail.gmail.com/
https://lore.kernel.org/lkml/[email protected]/
Signature · 2 lines
Thanks. -- Max