diff options
author | Johannes Berg <johannes.berg@intel.com> | 2019-09-23 07:51:16 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2019-10-01 11:56:18 -0400 |
commit | f43e5210c739fe76a4b0ed851559d6902f20ceb1 (patch) | |
tree | de93e4b4a1738b2373d6492e67c2a9979ef5b540 | |
parent | 242b0931c1918c56cd1dc5563fd250a3c39b996d (diff) |
cfg80211: initialize on-stack chandefs
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 <digetx@gmail.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/1569239475-I2dcce394ecf873376c386a78f31c2ec8b538fa25@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | net/wireless/nl80211.c | 4 | ||||
-rw-r--r-- | net/wireless/reg.c | 2 | ||||
-rw-r--r-- | net/wireless/wext-compat.c | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7386421e2ad3..10617566a117 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -2669,6 +2669,8 @@ int nl80211_parse_chandef(struct cfg80211_registered_device *rdev, | |||
2669 | 2669 | ||
2670 | control_freq = nla_get_u32(attrs[NL80211_ATTR_WIPHY_FREQ]); | 2670 | control_freq = nla_get_u32(attrs[NL80211_ATTR_WIPHY_FREQ]); |
2671 | 2671 | ||
2672 | memset(chandef, 0, sizeof(*chandef)); | ||
2673 | |||
2672 | chandef->chan = ieee80211_get_channel(&rdev->wiphy, control_freq); | 2674 | chandef->chan = ieee80211_get_channel(&rdev->wiphy, control_freq); |
2673 | chandef->width = NL80211_CHAN_WIDTH_20_NOHT; | 2675 | chandef->width = NL80211_CHAN_WIDTH_20_NOHT; |
2674 | chandef->center_freq1 = control_freq; | 2676 | chandef->center_freq1 = control_freq; |
@@ -3209,7 +3211,7 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag | |||
3209 | 3211 | ||
3210 | if (rdev->ops->get_channel) { | 3212 | if (rdev->ops->get_channel) { |
3211 | int ret; | 3213 | int ret; |
3212 | struct cfg80211_chan_def chandef; | 3214 | struct cfg80211_chan_def chandef = {}; |
3213 | 3215 | ||
3214 | ret = rdev_get_channel(rdev, wdev, &chandef); | 3216 | ret = rdev_get_channel(rdev, wdev, &chandef); |
3215 | if (ret == 0) { | 3217 | if (ret == 0) { |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 5311d0ae2454..420c4207ab59 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -2108,7 +2108,7 @@ static void reg_call_notifier(struct wiphy *wiphy, | |||
2108 | 2108 | ||
2109 | static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) | 2109 | static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) |
2110 | { | 2110 | { |
2111 | struct cfg80211_chan_def chandef; | 2111 | struct cfg80211_chan_def chandef = {}; |
2112 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); | 2112 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); |
2113 | enum nl80211_iftype iftype; | 2113 | enum nl80211_iftype iftype; |
2114 | 2114 | ||
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index 7b6529d81c61..cac9e28d852b 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c | |||
@@ -798,7 +798,7 @@ static int cfg80211_wext_giwfreq(struct net_device *dev, | |||
798 | { | 798 | { |
799 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 799 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
800 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); | 800 | struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); |
801 | struct cfg80211_chan_def chandef; | 801 | struct cfg80211_chan_def chandef = {}; |
802 | int ret; | 802 | int ret; |
803 | 803 | ||
804 | switch (wdev->iftype) { | 804 | switch (wdev->iftype) { |