Skip to contentSkip to conversation

: Potential ax25_uid_assoc-s leaks on module unload.

PATCH Applied Pavel Emelyanov 2 participants 2 messages Apr 12, 2008 – Apr 13, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Potential ax25_uid_assoc-s leaks on module unload.

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.

---

net/ax25/ax25_uid.c +2 -0
index 5f4eb73..57aeba7 100644
@@ -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);
 }
maintainer Applied
#1 lore raw

From: Pavel Emelyanov <[email protected]>
Date: Sat, 12 Apr 2008 16:05:44 +0400

Quoted 9 lines

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.

Applied, thanks Pavel.