2023-09-19 07:35:51

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] tty: fix memory leak in gsm_activate_mux

On Tue, Sep 19, 2023 at 11:45:25AM +0800, Edward AD wrote:
> When the call to gsm_register_devices() fails, we need to reclaim the memory
> requested in gsm_dlci_alloc().
>
> Fixes: 01aecd917114 ("tty: n_gsm: fix tty registration before control channel open")
> Reported-and-tested-by: [email protected]
> Signed-off-by: Edward AD <[email protected]>
> ---
> drivers/tty/n_gsm.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)

<snip>

You sent 5 of these, all identical, all rejected by lore.kernel.org, are
you sure your email servers are not on some spam blacklist somewhere?

greg k-h


2023-09-19 16:24:22

by Edward AD

[permalink] [raw]
Subject: [PATCH] tty: fix memory leak in gsm_activate_mux

When the call to gsm_register_devices() fails, we need to reclaim the memory
requested in gsm_dlci_alloc().

Fixes: 01aecd917114 ("tty: n_gsm: fix tty registration before control channel open")
Reported-and-tested-by: [email protected]
Signed-off-by: Edward AD <[email protected]>
---
drivers/tty/n_gsm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index b3550ff9c494..df9bb87652b0 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -3136,8 +3136,10 @@ static int gsm_activate_mux(struct gsm_mux *gsm)
gsm->receive = gsm1_receive;

ret = gsm_register_devices(gsm_tty_driver, gsm->num);
- if (ret)
+ if (ret) {
+ gsm_dlci_free(&dlci->port);
return ret;
+ }

gsm->has_devices = true;
gsm->dead = false; /* Tty opens are now permissible */
--
2.25.1