public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: ipwireless: fix memory leak in do_go_offline()
@ 2026-03-06  3:40 Qingfang Deng
  2026-03-12 12:00 ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Qingfang Deng @ 2026-03-06  3:40 UTC (permalink / raw)
  To: Jiri Kosina, David Sterba, Greg Kroah-Hartman, Jiri Slaby,
	Stephen Blackheath, Ben Martel, linux-kernel, linux-serial

The ppp_channel is allocated and registered in do_go_online(). But when
the channel is unregistered in do_go_offline(), the driver forgets to
release its memory. This leads to a memory leak each time the network
goes online and then offline.

Fix this by adding a kfree call after unregistering the channel.

Fixes: 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem")
Signed-off-by: Qingfang Deng <dqfext@gmail.com>
---
 drivers/tty/ipwireless/network.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/ipwireless/network.c b/drivers/tty/ipwireless/network.c
index ad2c5157a018..ec0353c1005a 100644
--- a/drivers/tty/ipwireless/network.c
+++ b/drivers/tty/ipwireless/network.c
@@ -303,6 +303,7 @@ static void do_go_offline(struct work_struct *work_go_offline)
 		spin_unlock_irqrestore(&network->lock, flags);
 		mutex_unlock(&network->close_lock);
 		ppp_unregister_channel(channel);
+		kfree(channel);
 	} else {
 		spin_unlock_irqrestore(&network->lock, flags);
 		mutex_unlock(&network->close_lock);
-- 
2.43.0


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

* Re: [PATCH] tty: ipwireless: fix memory leak in do_go_offline()
  2026-03-06  3:40 [PATCH] tty: ipwireless: fix memory leak in do_go_offline() Qingfang Deng
@ 2026-03-12 12:00 ` David Sterba
  2026-03-12 13:40   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2026-03-12 12:00 UTC (permalink / raw)
  To: Qingfang Deng
  Cc: Jiri Kosina, David Sterba, Greg Kroah-Hartman, Jiri Slaby,
	Stephen Blackheath, Ben Martel, linux-kernel, linux-serial

On Fri, Mar 06, 2026 at 11:40:58AM +0800, Qingfang Deng wrote:
> The ppp_channel is allocated and registered in do_go_online(). But when
> the channel is unregistered in do_go_offline(), the driver forgets to
> release its memory. This leads to a memory leak each time the network
> goes online and then offline.
> 
> Fix this by adding a kfree call after unregistering the channel.
> 
> Fixes: 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem")
> Signed-off-by: Qingfang Deng <dqfext@gmail.com>

Thanks, but the driver is going to be deleted.

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

* Re: [PATCH] tty: ipwireless: fix memory leak in do_go_offline()
  2026-03-12 12:00 ` David Sterba
@ 2026-03-12 13:40   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-03-12 13:40 UTC (permalink / raw)
  To: David Sterba
  Cc: Qingfang Deng, Jiri Kosina, David Sterba, Jiri Slaby,
	Stephen Blackheath, Ben Martel, linux-kernel, linux-serial

On Thu, Mar 12, 2026 at 01:00:36PM +0100, David Sterba wrote:
> On Fri, Mar 06, 2026 at 11:40:58AM +0800, Qingfang Deng wrote:
> > The ppp_channel is allocated and registered in do_go_online(). But when
> > the channel is unregistered in do_go_offline(), the driver forgets to
> > release its memory. This leads to a memory leak each time the network
> > goes online and then offline.
> > 
> > Fix this by adding a kfree call after unregistering the channel.
> > 
> > Fixes: 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem")
> > Signed-off-by: Qingfang Deng <dqfext@gmail.com>
> 
> Thanks, but the driver is going to be deleted.
> 

Great, can you send a patch to do that?

thanks,

greg k-h

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

end of thread, other threads:[~2026-03-12 13:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06  3:40 [PATCH] tty: ipwireless: fix memory leak in do_go_offline() Qingfang Deng
2026-03-12 12:00 ` David Sterba
2026-03-12 13:40   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox