From: Johannes Berg <johannes@sipsolutions.net>
To: En-Wei Wu <en-wei.wu@canonical.com>,
kvalo@kernel.org, edumazet@google.com, davem@davemloft.net,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: rickywu0421@gmail.com,
syzbot+d6eb9cee2885ec06f5e3@syzkaller.appspotmail.com
Subject: Re: [PATCH] wifi: virt_wifi: avoid reporting connection success with wrong SSID
Date: Thu, 04 Jul 2024 10:52:20 +0200 [thread overview]
Message-ID: <cc86acec3c7b0daab85263acba6eef42fe9cd0ec.camel@sipsolutions.net> (raw)
In-Reply-To: <20240704030304.16213-1-en-wei.wu@canonical.com>
On Thu, 2024-07-04 at 11:03 +0800, En-Wei Wu wrote:
>
> +#define VIRT_WIFI_SSID_LEN 8
> +#define VIRT_WIFI_SSID "VirtWifi"
Use strlen(VIRT_WIFI_SSID) for VIRT_WIFI_SSID_LEN maybe? It should be
constant "enough" for the compiler.
> + if (!sme->ssid) {
> + wiphy_err(wiphy, "invalid SSID\n");
> + return -EINVAL;
I wouldn't print an error here
> + ssid_len = min_t(u32, sme->ssid_len, IEEE80211_MAX_SSID_LEN);
The min_t() is unnecessary, cfg80211 won't give you too long SSIDs.
> bool right_addr = ether_addr_equal(requested_bss, fake_router_bssid);
> + bool right_ssid = (priv->connect_requested_ssid_len == VIRT_WIFI_SSID_LEN ?
> + !memcmp(priv->connect_requested_ssid, VIRT_WIFI_SSID,
> + priv->connect_requested_ssid_len) : false);
the ternary seems odd, why not just
priv->connect_requested_ssid_len == VIRT_WIFI_SSID_LEN &&
!memcmp(...);
?
johannes
prev parent reply other threads:[~2024-07-04 8:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-04 3:03 En-Wei Wu
2024-07-04 3:12 ` En-Wei WU
2024-07-04 8:52 ` Johannes Berg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cc86acec3c7b0daab85263acba6eef42fe9cd0ec.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=en-wei.wu@canonical.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=rickywu0421@gmail.com \
--cc=syzbot+d6eb9cee2885ec06f5e3@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®