Skip to contentSkip to conversation

irlmp_unregister_link needs to free lsaps hashbin

PATCH In review [email protected] 2 participants 3 messages Oct 12, 2007 – Oct 15, 2007 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irlmp_unregister_link needs to free lsaps hashbin

Hi,

While testing the mcs7780 based IrDA USB dongle I've stumbled upon memory leak in irlmp_unregister_link(). Hashbin for lsaps is created in irlmp_register_link and should probably be freed in irlmp_unregister_link().

Best regards,
Hinko

----

net/irda/irlmp.c renamed from net/irda/irlmp.c.orig +1 -0
@@ -353,6 +353,7 @@ void irlmp_unregister_link(__u32 saddr)
 		/* Final cleanup */
 		del_timer(&link->idle_timer);
 		link->magic = 0;
+		hashbin_delete(link->lsaps, (FREE_FUNC) kfree);
 		kfree(link);
 	}
 }
#1 lore raw

Hi Hinko,

Quoted 18 lines · On Fri, Oct 12, 2007 at 02:56:27PM +0200, [email protected] wrote:

Hi,

While testing the mcs7780 based IrDA USB dongle I've stumbled upon memory leak in irlmp_unregister_link(). Hashbin for lsaps is created in irlmp_register_link and should probably be freed in irlmp_unregister_link().

Best regards,
Hinko

----

net/irda/irlmp.c void irlmp_unregister_link(__u32 saddr) · line 356

Quoted 4 lines
net/irda/irlmp.c renamed from net/irda/irlmp.c.orig +1 -0
@@ -353,6 +353,7 @@ void irlmp_unregister_link(__u32 saddr)
 		/* Final cleanup */
 		del_timer(&link->idle_timer);
 		link->magic = 0;
+		hashbin_delete(link->lsaps, (FREE_FUNC) kfree);

Good catch, but I think the right fix sould be:
+ hashbin_delete(link->lsaps, (FREE_FUNC) __irlmp_close_lsap);

and I'll forward it. Thanks a lot.

Cheers,
Samuel.

Quoted 13 lines
net/irda/irlmp.c renamed from net/irda/irlmp.c.orig +0 -1
 		kfree(link);
 	}
 }
 
-------------------------------------------------------------------------

This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
irda-users mailing list
[email protected]
http://lists.sourceforge.net/lists/listinfo/irda-users

#2 lore raw
Quoted 18 lines · Samuel Ortiz

Hi Hinko,

Quoted 14 lines · On Fri, Oct 12, 2007 at 02:56:27PM +0200, [email protected] wrote:

Hi,

While testing the mcs7780 based IrDA USB dongle I've stumbled upon memory leak in irlmp_unregister_link(). Hashbin for lsaps is created in irlmp_register_link and should probably be freed in irlmp_unregister_link().

Best regards,
Hinko

----

Quoted 10 lines

net/irda/irlmp.c void irlmp_unregister_link(__u32 saddr) · line 356

Quoted 7 lines
net/irda/irlmp.c renamed from net/irda/irlmp.c.orig +1 -0
@@ -353,6 +353,7 @@ void irlmp_unregister_link(__u32 saddr)
 		/* Final cleanup */
 		del_timer(&link->idle_timer);
 		link->magic = 0;
+		hashbin_delete(link->lsaps, (FREE_FUNC) kfree);

Good catch, but I think the right fix sould be:
+ hashbin_delete(link->lsaps, (FREE_FUNC) __irlmp_close_lsap);

You're probably right since struct lsap_cb get inserted into the hashbin.

Regards,
Hinko

Signature · 7 lines
ČETRTA POT, d.o.o., Kranj
Planina 3
4000 Kranj
Slovenia, Europe
Tel. +386 (0) 4 280 66 03
E-mail: [email protected]
Http: www.cetrtapot.si