Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1084959ybl; Wed, 14 Aug 2019 10:27:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqySqVqBl76U870+av1bCgarbXBB7pippG8HUi+W2JEgnixEE/aiTw1CKo0nf3tiJ9dI/L2y X-Received: by 2002:aa7:9abc:: with SMTP id x28mr1088696pfi.234.1565803621640; Wed, 14 Aug 2019 10:27:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565803621; cv=none; d=google.com; s=arc-20160816; b=xdWEud3tYOGjciK8KMHyCFCQhpD9C4vfEoNHE4dYsXApJWRByHeNgl05BvAHtKAIM4 f8/GaFPjFdo+JHdd/EzWWLn0Vih131pUoKJRAt4R7fHF5RL0Tli9ByAEfZOMq3jMD3m6 or+9uE9rv1vm7OvT5mfJdA0NX945OU/SRwAnk3MGBxP68rxzJkfZbpQFX9OIBaADL5+o fbn+EZRoRfc/bNm5J+zWza6yNMcjNtL2E2xADpXgxxFh8giS4jGwQX9I91hf+BktdvW/ MDBnIoBkMevcdyivoYoBmFj+P9Oomw2xuOqtjMtN5Q7YzGAZBOXh7ie0bTmyo0hr2Ne+ y02w== 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=pd0azWR7788ng4nfMIjz/I6xY1jfD7QbTXF3+hueJ+w=; b=Y8eQnAdrq2+eZFbatq8ttO53MMKGPDJ7CTkXSEUJSfyzsOzKNMn2ewd/ZcZG39RwRS 8SGXhdenP80WZKD20bTlugEz7RKUmtJFN3p8yUYp76yU7MLH/+TiSBrcKL6My4EcaLaZ ALWmYsdPq+VY+5xJIltqY+EVhQlR5g2DZgb5/mbp0QI1g9kgLA3CVxOuCADgPd2X4nb+ 14Z3IS7dmE2qxMXdAq7WbTIQWXtGi9KVyEsz287s7jEximzOH7uAnT0yoFdO2lYF6T0S vk8PsUMMwhP5Ed+0z8vtgvQrY+gI+/v5L28GEELLqdRzx5po/6Z6or7OQupwy/PR3mPy OXdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U3Z1LHF+; 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 l10si167105pgp.411.2019.08.14.10.26.46; Wed, 14 Aug 2019 10:27:01 -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=U3Z1LHF+; 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 S1729746AbfHNR0I (ORCPT + 99 others); Wed, 14 Aug 2019 13:26:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:54108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728576AbfHNRFN (ORCPT ); Wed, 14 Aug 2019 13:05:13 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 BB628208C2; Wed, 14 Aug 2019 17:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802312; bh=X2Xp1Ub7iOB42ET/E+acLVe+OBzEfYU8mumcHqqqrwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U3Z1LHF+rrcmwP5slC8bMbJNILEBoXEIIdU9HWN17tAGBXE5EUVtWclYtlZCHAW9j VA5J+SMzV1XQ9covLpgxXq9VZKu7JagICLPvKEWULdLLzi5hDpfWeMo7Nvpbe8v2YM yjhdqR5oZFDrZhfyF3Jl/GIVQQlQTF4Q64+c73S0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Johannes Berg , Sasha Levin Subject: [PATCH 5.2 076/144] mac80211: fix possible memory leak in ieee80211_assign_beacon Date: Wed, 14 Aug 2019 19:00:32 +0200 Message-Id: <20190814165803.034950064@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@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 [ Upstream commit bcc27fab8cc673ddc95452674373cce618ccb3a3 ] Free new beacon_data in ieee80211_assign_beacon whenever ieee80211_assign_beacon fails Fixes: 8860020e0be1 ("cfg80211: restructure AP/GO mode API") Fixes: bc847970f432 ("mac80211: support FTM responder configuration/statistic") Signed-off-by: Lorenzo Bianconi Link: https://lore.kernel.org/r/770285772543c9fca33777bb4ad4760239e56256.1562105631.git.lorenzo@kernel.org Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/cfg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index a1973a26c7fc4..b8288125e05db 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -935,8 +935,10 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, err = ieee80211_set_probe_resp(sdata, params->probe_resp, params->probe_resp_len, csa); - if (err < 0) + if (err < 0) { + kfree(new); return err; + } if (err == 0) changed |= BSS_CHANGED_AP_PROBE_RESP; @@ -948,8 +950,10 @@ static int ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata, params->civicloc, params->civicloc_len); - if (err < 0) + if (err < 0) { + kfree(new); return err; + } changed |= BSS_CHANGED_FTM_RESPONDER; } -- 2.20.1