Skip to content

Commit

Permalink
cfg80211: initialize on-stack chandefs
Browse files Browse the repository at this point in the history
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: [email protected]
Fixes: 2a38075 ("nl80211: Add support for EDMG channels")
Reported-by: Dmitry Osipenko <[email protected]>
Tested-by: Dmitry Osipenko <[email protected]>
Link: https://lore.kernel.org/r/1569239475-I2dcce394ecf873376c386a78f31c2ec8b538fa25@changeid
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
jmberg-intel committed Oct 1, 2019
1 parent 242b093 commit f43e521
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -2669,6 +2669,8 @@ int nl80211_parse_chandef(struct cfg80211_registered_device *rdev,

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;
Expand Down Expand Up @@ -3209,7 +3211,7 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag

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) {
Expand Down
2 changes: 1 addition & 1 deletion net/wireless/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2108,7 +2108,7 @@ static void reg_call_notifier(struct wiphy *wiphy,

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;

Expand Down
2 changes: 1 addition & 1 deletion net/wireless/wext-compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ static int cfg80211_wext_giwfreq(struct net_device *dev,
{
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) {
Expand Down

0 comments on commit f43e521

Please sign in to comment.