Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755291AbcD0Apl (ORCPT ); Tue, 26 Apr 2016 20:45:41 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39603 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753271AbcDZXN2 (ORCPT ); Tue, 26 Apr 2016 19:13:28 -0400 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Julian Calaby" , "Sudip Mukherjee" , "Johannes Berg" Date: Wed, 27 Apr 2016 01:02:24 +0200 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.2 011/115] mac80211: fix memory leak In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8426:ae4:c500:9cba:69ae:962d:6167 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1190 Lines: 36 3.2.80-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Sudip Mukherjee commit ea32f065bd3e3e09f0bcb3042f1664caf6b3e233 upstream. On error we jumped to the error label and returned the error code but we missed releasing sinfo. Fixes: 5fe74014172d ("mac80211: avoid excessive stack usage in sta_info") Reviewed-by: Julian Calaby Signed-off-by: Sudip Mukherjee Signed-off-by: Johannes Berg [bwh: Backported to 3.2: there's no out_err label but there is another error case that would leak sinfo] Signed-off-by: Ben Hutchings --- net/mac80211/sta_info.c | 1 + 1 file changed, 1 insertion(+) --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -362,8 +362,10 @@ static int sta_info_finish_insert(struct u.ap); err = drv_sta_add(local, sdata, &sta->sta); if (err) { - if (!async) + if (!async) { + kfree(sinfo); return err; + } printk(KERN_DEBUG "%s: failed to add IBSS STA %pM to " "driver (%d) - keeping it anyway.\n", sdata->name, sta->sta.addr, err);