Skip to content

Commit eec7ef3

Browse files
jmberg-intelgregkh
authored andcommitted
cfg80211: initialize on-stack chandefs
commit f43e521 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: [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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2f2f3ff commit eec7ef3

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

net/wireless/nl80211.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2069,6 +2069,8 @@ static int nl80211_parse_chandef(struct cfg80211_registered_device *rdev,
20692069

20702070
control_freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]);
20712071

2072+
memset(chandef, 0, sizeof(*chandef));
2073+
20722074
chandef->chan = ieee80211_get_channel(&rdev->wiphy, control_freq);
20732075
chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
20742076
chandef->center_freq1 = control_freq;
@@ -2538,7 +2540,7 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag
25382540

25392541
if (rdev->ops->get_channel) {
25402542
int ret;
2541-
struct cfg80211_chan_def chandef;
2543+
struct cfg80211_chan_def chandef = {};
25422544

25432545
ret = rdev_get_channel(rdev, wdev, &chandef);
25442546
if (ret == 0) {

net/wireless/reg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1564,7 +1564,7 @@ static void reg_call_notifier(struct wiphy *wiphy,
15641564

15651565
static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev)
15661566
{
1567-
struct cfg80211_chan_def chandef;
1567+
struct cfg80211_chan_def chandef = {};
15681568
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
15691569
enum nl80211_iftype iftype;
15701570

net/wireless/wext-compat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ static int cfg80211_wext_giwfreq(struct net_device *dev,
799799
{
800800
struct wireless_dev *wdev = dev->ieee80211_ptr;
801801
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
802-
struct cfg80211_chan_def chandef;
802+
struct cfg80211_chan_def chandef = {};
803803
int ret;
804804

805805
switch (wdev->iftype) {

0 commit comments

Comments
 (0)