Commit 3a0e6733 authored by Johannes Berg's avatar Johannes Berg Committed by Greg Kroah-Hartman

cfg80211: initialize on-stack chandefs

commit f43e5210 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: 2a38075c ("nl80211: Add support for EDMG channels")
Reported-by: default avatarDmitry Osipenko <digetx@gmail.com>
Tested-by: default avatarDmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/1569239475-I2dcce394ecf873376c386a78f31c2ec8b538fa25@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 16c75eb1
...@@ -2299,6 +2299,8 @@ static int nl80211_parse_chandef(struct cfg80211_registered_device *rdev, ...@@ -2299,6 +2299,8 @@ static int nl80211_parse_chandef(struct cfg80211_registered_device *rdev,
control_freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); 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->chan = ieee80211_get_channel(&rdev->wiphy, control_freq);
chandef->width = NL80211_CHAN_WIDTH_20_NOHT; chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
chandef->center_freq1 = control_freq; chandef->center_freq1 = control_freq;
...@@ -2819,7 +2821,7 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag ...@@ -2819,7 +2821,7 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag
if (rdev->ops->get_channel) { if (rdev->ops->get_channel) {
int ret; int ret;
struct cfg80211_chan_def chandef; struct cfg80211_chan_def chandef = {};
ret = rdev_get_channel(rdev, wdev, &chandef); ret = rdev_get_channel(rdev, wdev, &chandef);
if (ret == 0) { if (ret == 0) {
......
...@@ -2095,7 +2095,7 @@ static void reg_call_notifier(struct wiphy *wiphy, ...@@ -2095,7 +2095,7 @@ static void reg_call_notifier(struct wiphy *wiphy,
static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) 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); struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
enum nl80211_iftype iftype; enum nl80211_iftype iftype;
......
...@@ -800,7 +800,7 @@ static int cfg80211_wext_giwfreq(struct net_device *dev, ...@@ -800,7 +800,7 @@ static int cfg80211_wext_giwfreq(struct net_device *dev,
{ {
struct wireless_dev *wdev = dev->ieee80211_ptr; struct wireless_dev *wdev = dev->ieee80211_ptr;
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
struct cfg80211_chan_def chandef; struct cfg80211_chan_def chandef = {};
int ret; int ret;
switch (wdev->iftype) { switch (wdev->iftype) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment