Skip to contentSkip to conversation

tty: ipwireless: fix memory leak in do_go_offline()

PATCH In review Qingfang Deng 3 participants 5 messages Mar 6 – Apr 10 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty: ipwireless: fix memory leak in do_go_offline()

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")
---
 drivers/tty/ipwireless/network.c | 1 +
 1 file changed, 1 insertion(+)
drivers/tty/ipwireless/network.c +1 -0
index ad2c5157a018..ec0353c1005a 100644
@@ -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);
Signature · 1 line
2.43.0
#1 lore raw
Quoted 9 lines · Qingfang Deng

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")

Thanks, but the driver is going to be deleted.

#2 lore raw
Quoted 6 lines · David Sterba
Quoted 5 lines · Qingfang Deng

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.

Quoted 7 lines
Quoted 4 lines

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

Fixes 099dc4fb6265 ("ipwireless: driver for PC Card 3G/UMTS modem")

Thanks, but the driver is going to be deleted.

Great, can you send a patch to do that?

thanks,

greg k-h

#3 lore raw
In reply to David Sterba

Hi, Greg and David,

Quoted 2 lines · David Sterba

Thanks, but the driver is going to be deleted.

Even if this is being removed from tty-next, the fix should be applied and backported to -stable.

Regards,
Qingfang

#4 lore raw
Quoted 8 lines · Qingfang Deng

Hi, Greg and David,

Quoted 2 lines · David Sterba

Thanks, but the driver is going to be deleted.

Even if this is being removed from tty-next, the fix should be applied and backported to -stable.

We can just delete it from stable trees, as obviously no one is using it.

thanks,

greg k-h