* [PATCH] cfg80211: initialize on-stack chandefs
@ 2019-09-23 11:51 Johannes Berg
2019-09-23 12:12 ` Dmitry Osipenko
2019-09-23 12:16 ` [EXT] " Dedy Lansky
0 siblings, 2 replies; 5+ messages in thread
From: Johannes Berg @ 2019-09-23 11:51 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg, Dmitry Osipenko
From: Johannes Berg <johannes.berg@intel.com>
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.
Fixes: 2a38075cd0be ("nl80211: Add support for EDMG channels")
Reported-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/wireless/nl80211.c | 4 +++-
net/wireless/reg.c | 2 +-
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 d21b1581a665..b9797a3c110a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2636,6 +2636,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;
@@ -3176,7 +3178,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) {
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,
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;
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,
{
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) {
--
2.20.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] cfg80211: initialize on-stack chandefs
2019-09-23 11:51 [PATCH] cfg80211: initialize on-stack chandefs Johannes Berg
@ 2019-09-23 12:12 ` Dmitry Osipenko
2019-09-23 12:13 ` Johannes Berg
2019-09-23 12:16 ` [EXT] " Dedy Lansky
1 sibling, 1 reply; 5+ messages in thread
From: Dmitry Osipenko @ 2019-09-23 12:12 UTC (permalink / raw)
To: Johannes Berg, linux-wireless; +Cc: Johannes Berg
23.09.2019 14:51, Johannes Berg пишет:
> From: Johannes Berg <johannes.berg@intel.com>
>
> 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.
>
> Fixes: 2a38075cd0be ("nl80211: Add support for EDMG channels")
> Reported-by: Dmitry Osipenko <digetx@gmail.com>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
> net/wireless/nl80211.c | 4 +++-
> net/wireless/reg.c | 2 +-
> net/wireless/wext-compat.c | 2 +-
> 3 files changed, 5 insertions(+), 3 deletions(-)
Johannes, thank you very much!
Tested-by: Dmitry Osipenko <digetx@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cfg80211: initialize on-stack chandefs
2019-09-23 12:12 ` Dmitry Osipenko
@ 2019-09-23 12:13 ` Johannes Berg
2019-09-23 12:59 ` Dmitry Osipenko
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2019-09-23 12:13 UTC (permalink / raw)
To: Dmitry Osipenko, linux-wireless
On Mon, 2019-09-23 at 15:12 +0300, Dmitry Osipenko wrote:
>
> Tested-by: Dmitry Osipenko <digetx@gmail.com>
That was quick, heh!
Thanks,
johannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [EXT] [PATCH] cfg80211: initialize on-stack chandefs
2019-09-23 11:51 [PATCH] cfg80211: initialize on-stack chandefs Johannes Berg
2019-09-23 12:12 ` Dmitry Osipenko
@ 2019-09-23 12:16 ` Dedy Lansky
1 sibling, 0 replies; 5+ messages in thread
From: Dedy Lansky @ 2019-09-23 12:16 UTC (permalink / raw)
To: 'Johannes Berg', linux-wireless
Cc: 'Johannes Berg', 'Dmitry Osipenko'
From: Johannes Berg <johannes.berg@intel.com>
>
> ---
> net/wireless/nl80211.c | 4 +++-
> net/wireless/reg.c | 2 +-
> net/wireless/wext-compat.c | 2 +-
> 3 files changed, 5 insertions(+), 3 deletions(-)
We planned to upload pretty much same fix today. You beat us on this.
We thought also to add memset in ieee80211_build_preq_ies()
(net/mac80211/util.c) but maybe this is not critical.
Thanks,
Dedy.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cfg80211: initialize on-stack chandefs
2019-09-23 12:13 ` Johannes Berg
@ 2019-09-23 12:59 ` Dmitry Osipenko
0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Osipenko @ 2019-09-23 12:59 UTC (permalink / raw)
To: Johannes Berg, linux-wireless
23.09.2019 15:13, Johannes Berg пишет:
> On Mon, 2019-09-23 at 15:12 +0300, Dmitry Osipenko wrote:
>>
>> Tested-by: Dmitry Osipenko <digetx@gmail.com>
>
> That was quick, heh!
Yes, it happened that I was doing some kernel work, had device to test
under my hand and checked email in the right time. Thanks again!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-09-23 12:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-23 11:51 [PATCH] cfg80211: initialize on-stack chandefs Johannes Berg
2019-09-23 12:12 ` Dmitry Osipenko
2019-09-23 12:13 ` Johannes Berg
2019-09-23 12:59 ` Dmitry Osipenko
2019-09-23 12:16 ` [EXT] " Dedy Lansky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).