From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47AD5C43613 for ; Mon, 24 Jun 2019 10:06:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 14C632146F for ; Mon, 24 Jun 2019 10:06:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561370802; bh=0UShVwJkVQmYqGoIXL46mVMoloO+EmCe9/+uzLfXZDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Kwc6ybqgyWaa5MW91Cdk69W3xtiyOo+Oh9J+LhO/FzQLYJvU4u9LWzmZQusu40CRH sjSDuyY5siqNDGvP0C5rZj8Nk0BA5gfuC10nyTbeV3Dl2fKCgf7TKYfIv0cWTTnsr7 sTa7lqQH0PfevuonXBQ6XrntS3Ms4+5rrh9JXbhs= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730154AbfFXKGk (ORCPT ); Mon, 24 Jun 2019 06:06:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:38944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730147AbfFXKGj (ORCPT ); Mon, 24 Jun 2019 06:06:39 -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 C586D2146F; Mon, 24 Jun 2019 10:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561370798; bh=0UShVwJkVQmYqGoIXL46mVMoloO+EmCe9/+uzLfXZDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I+pFKUVUhjalcZf9uOgEnfvuel87nqipVCmoLCabxcRss6wjG3OfiDs1IGR7Z0T3Y 61iF1r+OWwjq8GirpVw9x6pPvCWE2yMqLOtdNWnD1tgnAHCQRCtzcAabv5I/ovFEzk hja69o+o+PWloIZtgAK4dFOlWUvzK43Rhkr7aj0w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Strohman , Johannes Berg Subject: [PATCH 4.19 88/90] nl80211: fix station_info pertid memory leak Date: Mon, 24 Jun 2019 17:57:18 +0800 Message-Id: <20190624092319.649008473@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190624092313.788773607@linuxfoundation.org> References: <20190624092313.788773607@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -4611,8 +4611,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) ||