All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: mwifiex: fix a missing check of ssid
@ 2019-03-23 22:33 Kangjie Lu
  2019-03-25 18:30 ` Brian Norris
  0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-23 22:33 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Amitkumar Karwar, Nishant Sarmukadam, Ganapathi Bhat,
	Xinming Hu, Kalle Valo, David S. Miller, linux-wireless, netdev,
	linux-kernel

sme->ssid may be invalid and thus should be checked.

The fix adds such a check and returns an error if it is invalid.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index c46f0a54a0c7..a46820cf609f 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -2343,6 +2343,12 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev,
 	struct mwifiex_adapter *adapter = priv->adapter;
 	int ret;
 
+	if (!sme->ssid) {
+		mwifiex_dbg(adapter, ERROR,
+			    "%s: Invalid ssid\n", dev->name);
+		return -EOPNOTSUPP;
+	}
+
 	if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) {
 		mwifiex_dbg(adapter, ERROR,
 			    "%s: reject infra assoc request in non-STA role\n",
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: mwifiex: fix a missing check of ssid
  2019-03-23 22:33 [PATCH] net: mwifiex: fix a missing check of ssid Kangjie Lu
@ 2019-03-25 18:30 ` Brian Norris
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Norris @ 2019-03-25 18:30 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Amitkumar Karwar, Nishant Sarmukadam, Ganapathi Bhat,
	Xinming Hu, Kalle Valo, David S. Miller, linux-wireless,
	<netdev@vger.kernel.org>,
	Linux Kernel

On Sat, Mar 23, 2019 at 3:34 PM Kangjie Lu <kjlu@umn.edu> wrote:
> sme->ssid may be invalid and thus should be checked.

Under what conditions are you seeing this? I see that brcmfmac, for
one, also has a similar check, but IIUC, the connect API always
pre-checks that there's an SSID provided:

static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
{
        struct cfg80211_registered_device *rdev = info->user_ptr[0];
        struct net_device *dev = info->user_ptr[1];
        struct cfg80211_connect_params connect;
        struct wiphy *wiphy;
        struct cfg80211_cached_keys *connkeys = NULL;
        int err;

        memset(&connect, 0, sizeof(connect));

        if (!info->attrs[NL80211_ATTR_SSID] ||
            !nla_len(info->attrs[NL80211_ATTR_SSID]))
                return -EINVAL;
...
        connect.ssid = nla_data(info->attrs[NL80211_ATTR_SSID]);


So this patch shouldn't be necessary.

Perhaps I'm missing something though.

Regards,
Brian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-25 18:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-23 22:33 [PATCH] net: mwifiex: fix a missing check of ssid Kangjie Lu
2019-03-25 18:30 ` Brian Norris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.