netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][AX25]: Potential ax25_uid_assoc-s leaks on module unload.
@ 2008-04-12 12:05 Pavel Emelyanov
  2008-04-13  1:34 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Emelyanov @ 2008-04-12 12:05 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: David Miller, Linux Netdev List, linux-hams

The ax25_uid_free call walks the ax25_uid_list and releases
entries from it. The problem is that after the fisrt call to
hlist_del_init the hlist_for_each_entry (which hides behind
the ax25_uid_for_each) will consider the current position to
be the last and will return.

Thus, the whole list will be left not freed.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/ax25/ax25_uid.c b/net/ax25/ax25_uid.c
index 5f4eb73..57aeba7 100644
--- a/net/ax25/ax25_uid.c
+++ b/net/ax25/ax25_uid.c
@@ -218,9 +218,11 @@ void __exit ax25_uid_free(void)
 	struct hlist_node *node;
 
 	write_lock(&ax25_uid_lock);
+again:
 	ax25_uid_for_each(ax25_uid, node, &ax25_uid_list) {
 		hlist_del_init(&ax25_uid->uid_node);
 		ax25_uid_put(ax25_uid);
+		goto again;
 	}
 	write_unlock(&ax25_uid_lock);
 }

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

end of thread, other threads:[~2008-04-13  1:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-12 12:05 [PATCH][AX25]: Potential ax25_uid_assoc-s leaks on module unload Pavel Emelyanov
2008-04-13  1:34 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).