Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2077584ybp; Thu, 10 Oct 2019 01:47:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqysapfceDyqbcZDC6SKHxaQtfj3TU7gUeBwNq1x2vD70ZelHERbBxT13cYMKkw5lB9bmI89 X-Received: by 2002:aa7:d582:: with SMTP id r2mr7138219edq.196.1570697226417; Thu, 10 Oct 2019 01:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570697226; cv=none; d=google.com; s=arc-20160816; b=iIOXkeNG52R4ikc/MB/IjvSZNgyFKFtapLjP0HU3pTgROv0Wf2Ac8BJ3fPF1WdYvqg jJIK8oKwpr4ArRoqomTwq3c3HUkKFoTIEcbiDIvnWFpfefvQ/oSpls6A6qq59BWLRQe1 v8QLkL/CWuA/+B/gl3N0c5c7R9/Okvc1WaVdaYk6vrgi2h6SY7BIsa3RVgRQaUlTN220 WeoCek5/p6x6DZdBZ3FbUHLtxPatggoHdvD79MGCn2ytUvRhCYyecP4RG1ApVrdpjhKs YUceOlg2qteKNAbZVmW0q8/kJCk7Ld6WG4umcg4rU1c3VeJWHZBWipE8IZHpfjc2dXdj 9juQ== 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=P35TQzMkm2TuMHUsba50ToRisFJPDxhqm5pS9rJj+ew=; b=Cw4ijvmNpowl4Zu2hTWXKjLtHp+7L+/K1u8KK9Pp6qsGSdFB8ws268p8uBB6aYuTfw Sj3kBpvK6UNmsVpK/mwLa/RLfxGr+fiXxiI0aI78mgYJRojRGjjBWhv1GrQDdtjYemRr 4121PjvFVwtIDp0L0vpPdtuDN+am3uN7FWpdXmmESB2J7cnGCMvI0rmFPKK5ffyVTZcM TxEFW0qstIjoO6fgktGS3amuWdTzNZV28JaJvFq+29Gn0zmfBJAFK7J2FUHLh6wHImBg 2a8OmYnJE9WSO5WjuyXf5XGLR3vF4+tsqDk+3Hyby6MUzp1026hgojvadM6BmvAeJImm 4ZgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=POg6CoZf; 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 e5si2801936ejj.70.2019.10.10.01.46.43; Thu, 10 Oct 2019 01:47:06 -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=POg6CoZf; 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 S2387657AbfJJInY (ORCPT + 99 others); Thu, 10 Oct 2019 04:43:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:48192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388073AbfJJInW (ORCPT ); Thu, 10 Oct 2019 04:43:22 -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 9A39A2190F; Thu, 10 Oct 2019 08:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570697002; bh=BOanT1SW13OnGnjPMS6uXvmdJhRS0NsJ5UKaucbKJNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=POg6CoZfdbdNeAQlwE8pJm5wJrYy9BLnRM6TN6aG2ZHePC7TL3rfNcyKQ/HFhMu/5 YUHVB6QlY+5oWZuMjUY3RlY6SENziDFJoLC/g25mRsp07cwYL/udCm2VR0cdHmw38J i1vHxMgSejfHhEcuY5belnNcW+cL0rWKpB6riqF0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Johannes Berg Subject: [PATCH 5.3 087/148] cfg80211: initialize on-stack chandefs Date: Thu, 10 Oct 2019 10:35:48 +0200 Message-Id: <20191010083616.634383014@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@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: Johannes Berg commit f43e5210c739fe76a4b0ed851559d6902f20ceb1 upstream. In a few places we don't properly initialize on-stack chandefs, resulting in EDMG data to be non-zero, which broke things. Additionally, in a few places we rely on the driver to init the data completely, but perhaps we shouldn't as non-EDMG drivers may not initialize the EDMG data, also initialize it there. Cc: stable@vger.kernel.org Fixes: 2a38075cd0be ("nl80211: Add support for EDMG channels") Reported-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Link: https://lore.kernel.org/r/1569239475-I2dcce394ecf873376c386a78f31c2ec8b538fa25@changeid Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/wireless/nl80211.c | 4 +++- net/wireless/reg.c | 2 +- net/wireless/wext-compat.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -2597,6 +2597,8 @@ int nl80211_parse_chandef(struct cfg8021 control_freq = nla_get_u32(attrs[NL80211_ATTR_WIPHY_FREQ]); + memset(chandef, 0, sizeof(*chandef)); + chandef->chan = ieee80211_get_channel(&rdev->wiphy, control_freq); chandef->width = NL80211_CHAN_WIDTH_20_NOHT; chandef->center_freq1 = control_freq; @@ -3125,7 +3127,7 @@ static int nl80211_send_iface(struct sk_ if (rdev->ops->get_channel) { int ret; - struct cfg80211_chan_def chandef; + struct cfg80211_chan_def chandef = {}; ret = rdev_get_channel(rdev, wdev, &chandef); if (ret == 0) { --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2108,7 +2108,7 @@ static void reg_call_notifier(struct wip static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) { - struct cfg80211_chan_def chandef; + struct cfg80211_chan_def chandef = {}; struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); enum nl80211_iftype iftype; --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c @@ -797,7 +797,7 @@ static int cfg80211_wext_giwfreq(struct { struct wireless_dev *wdev = dev->ieee80211_ptr; struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); - struct cfg80211_chan_def chandef; + struct cfg80211_chan_def chandef = {}; int ret; switch (wdev->iftype) {