Thread (2 messages) 2 messages, 2 authors, 2021-11-15

Re: [PATCH] mac80211: fix a memory leak where sta_info is not freed

From: Johannes Berg <johannes@sipsolutions.net>
Date: 2021-11-15 10:06:52

On Sat, 2021-10-02 at 08:53 -0600, Ahmed Zaki wrote:
quoted hunk ↗ jump to hunk
+++ b/net/mac80211/sta_info.c
@@ -640,12 +640,14 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
 
 	/* check if STA exists already */
 	if (sta_info_get_bss(sdata, sta->sta.addr)) {
+		sta_info_free(local, sta);
 		err = -EEXIST;
 		goto out_err;
 	}
 
 	sinfo = kzalloc(sizeof(struct station_info), GFP_KERNEL);
 	if (!sinfo) {
+		sta_info_free(local, sta);
 		err = -ENOMEM;
 		goto out_err;
 	}
We already have a "out_drop_sta", that calls cleanup_single_sta(), so
shouldn't we just add a label there ("out_free_sta") just before
cleanup_single_sta() and then we don't need the extra call?

johannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help