Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp227884ybg; Thu, 17 Oct 2019 21:59:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyuIbzLNLnrNiz4u5ekzVz90Mvx9aARYEriJguGr7Mjh7psQJ6nJftTNhd61E8Rw1H24DKG X-Received: by 2002:aa7:dd0a:: with SMTP id i10mr7514128edv.189.1571374757052; Thu, 17 Oct 2019 21:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571374757; cv=none; d=google.com; s=arc-20160816; b=mHQCf8IilvXt8pQBXE7GU6yKs5ehbQ5uFuKfHUL7soD8axYeI67sOTK0tqpfioobpq zvAErqO4eoYW58yjE+iqXxTgwy0toS9kBdO58pE3tPPDCxrXFxNhUKuAhITlNV6atzgQ IuAkIpPCU8ihzztTlXT3xrmnoA9gXvFfLRdOcHOhwhxcfLaPH8pNpn3X0r65henNDm// XM8qUBjFqFRJH7zQoY4bieBjpxqcijqHYRqVv9RFmXv9xM/GkWF8uM8pOtcU1HGvz8pZ lnfhX8w6jXQzYnYErDZrfENgzbS3KUCHIuXeEln6pKno2RdkI+7to2BtGTsqJiT2f7zH UKwQ== 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=0vO7mJGwlyuV88zx4c6/rJ9G9hpz7INuEGvYi575Pf8=; b=krkwuHorCcmH1Tf4g7fX4Enfvn5OPh2hXOIPgrj5B66c0bDosMGV3MiApH5F3yXFYY tuh80DBOJlo1oTSPVHBeNaAIoMWLOXZMbosKyqu6bwZc5JjuKW+hWV/B8jWIr2dwuQM7 k+mNrRGQGOF1NWZ6bECAZGbCzxc6LnPkyXOpzXhRK2sDB7QvHaj1Gdlp0TeipXnToc96 1zIrY15cuedhU8qcRCxvDxTucv5Pp4a52OFgz0Uky2eoq9zZeKiDQFfXfgFtkQ47O4bk EQJfHbr43bjS4f/qbjnzErGvLZjore06Ou5SQs8yG9Xy50s8hYLonzHTD35l0Ju6Btek XXXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kid4bUIr; 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 j14si2888455edt.298.2019.10.17.21.58.54; Thu, 17 Oct 2019 21:59:17 -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=kid4bUIr; 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 S1731405AbfJPWRG (ORCPT + 99 others); Wed, 16 Oct 2019 18:17:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:45182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390245AbfJPVy5 (ORCPT ); Wed, 16 Oct 2019 17:54:57 -0400 Received: from localhost (unknown [192.55.54.58]) (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 363D521D7F; Wed, 16 Oct 2019 21:54:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571262897; bh=oQqt3M4StlXw6mUeaHdr3WrAtVNIj8RQ6R1srCQRt48=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kid4bUIrsiq2VFxzfI6laVNII0gJIg0hLSI2vNE8RdKvUBcVbjFE4Y7GuAiCaPJ5d 5cxmfvbsWGssjUH91mdd2SejeSw8h+/GT+az00x8p7ibZWf9+lnsK4WRk9R/uLa2zH y+rK+O7q7v0jAbmQJERa8Kd4I+uz1aOrH/85/W4M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Johannes Berg Subject: [PATCH 4.9 14/92] cfg80211: initialize on-stack chandefs Date: Wed, 16 Oct 2019 14:49:47 -0700 Message-Id: <20191016214811.372948112@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214759.600329427@linuxfoundation.org> References: <20191016214759.600329427@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 @@ -2069,6 +2069,8 @@ static int nl80211_parse_chandef(struct control_freq = nla_get_u32(info->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; @@ -2538,7 +2540,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 @@ -1564,7 +1564,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 @@ -799,7 +799,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) {