Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2255474ybd; Mon, 24 Jun 2019 03:24:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7e82IN8fx+aV/AfNHyxYnWgXzy9AQX8Sbp6uZfthTdno9t3fsO2GrMaG5PV554zb8lE0G X-Received: by 2002:a63:dc02:: with SMTP id s2mr32590416pgg.286.1561371853009; Mon, 24 Jun 2019 03:24:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561371853; cv=none; d=google.com; s=arc-20160816; b=jog9LMHY+gYzmyXbZdJ6OjWhUbXma6LhhbrwrFEhHz4llbjkFszazNs25q4ZKQBYsh H79H7WTX5UsyQaEt1ixcO78WkrJHWCllYBmJW4oCxKVZvs4mrgl5J2Xv8+XVchTcSYG6 kjXggB7WivAlsHwGarN0JQ5O/3SzYvPp7w/Asb2zEPKZcd9pdH/MsX6YHrOoBzReQs/1 R4hu2q1nEcKbuOQDyK9lgpWetSj7inQo226SKredHCevuSYDf9QpmsU1u2JgUORv3nlm h1RKoLroQl/G/O4zWrYwcWBTp/+B//79iVD99fvxO7K073EnE2hQo3XZTTjLCDscVJwM lYJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=chAo+KdvXszxaTl6xcGmDai6TYrPDRtIsb44QUV/hKw=; b=qQ1RryenFuAa8ZHNP//8cV+Xw1/Yq2u5hBQg37hkTApNgenlWjV0ppG39ntD+teMfT jOnxt6GpP4CQhuUnob/KGYfke1BUHXnPoBx6TQhyt6oMlJ6mwAgVjSXkRR0erazUsl8a y1KEvH69QqvjIBZ5iKmS1wyZPtVQHLYV1Qq5IWdmuBYdIfbA/u1Ar8QziuvpwGvwnHig qYLFneHCR4xLRJAY9YQitGkMPInqnQ9Qv5BJ1WlSmNqMIf4l0MbjxBdyCFSTEJWp5Nsq c8cr6QV2GAsbYQpWOiFTLGdiVR/147BENtBiPGJszKGxRGd1D9YLM5p1b2H2yB8AuUv0 L0bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FDfYj72j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si9827711pgb.354.2019.06.24.03.23.57; Mon, 24 Jun 2019 03:24:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FDfYj72j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730874AbfFXKVz (ORCPT + 99 others); Mon, 24 Jun 2019 06:21:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:57662 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730847AbfFXKVx (ORCPT ); Mon, 24 Jun 2019 06:21:53 -0400 Received: from localhost (f4.8f.5177.ip4.static.sl-reverse.com [119.81.143.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4ACE120645; Mon, 24 Jun 2019 10:21:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561371712; bh=zy3TIc91CTwi1EVVwKfDJ9F8ob/YSF3+Uyo8RP+Bj8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FDfYj72jTeEbapjY9nq8ZsYxql75mrKTbZJqP2aOD36Xsl6KLYwdT7xv1PbrdwiBR VHk8jZY2U86oge4LvOA0GPCsGaTCfc/gE0N7NKijKlhUgMwVT5ZrEQ4pj/nw3vahdR bpzGESe1yoEi3JOPlKP6X0/vG+74IMx/wkRZbz6Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Strohman , Johannes Berg Subject: [PATCH 5.1 119/121] nl80211: fix station_info pertid memory leak Date: Mon, 24 Jun 2019 17:57:31 +0800 Message-Id: <20190624092326.692565391@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190624092320.652599624@linuxfoundation.org> References: <20190624092320.652599624@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Strohman commit f77bf4863dc2218362f4227d56af4a5f3f08830c upstream. When dumping stations, memory allocated for station_info's pertid member will leak if the nl80211 header cannot be added to the sk_buff due to insufficient tail room. I noticed this leak in the kmalloc-2048 cache. Cc: stable@vger.kernel.org Fixes: 8689c051a201 ("cfg80211: dynamically allocate per-tid stats for station info") Signed-off-by: Andy Strohman Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/wireless/nl80211.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -4804,8 +4804,10 @@ static int nl80211_send_station(struct s struct nlattr *sinfoattr, *bss_param; hdr = nl80211hdr_put(msg, portid, seq, flags, cmd); - if (!hdr) + if (!hdr) { + cfg80211_sinfo_release_content(sinfo); return -1; + } if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex) || nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr) ||