linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivo van Doorn <ivdoorn@gmail.com>
To: "John Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH] rt2x00: fix NULL pointer exception
Date: Wed, 28 Feb 2007 23:08:36 +0100	[thread overview]
Message-ID: <200702282308.36935.IvDoorn@gmail.com> (raw)

This will fix a NULL pointer exception when working in master mode.
When a master mode interface is added, the bssid is initialized,
when config_interface() is called the bssid is invalid (only with master mode)
so we cannot use that, instead the bssid inside the interface structure should
be used.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>

---

diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2x00lib.c b/drivers/net/wireless/mac80211/rt2x00/rt2x00lib.c
index e882182..8dacf00 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2x00lib.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2x00lib.c
@@ -480,6 +480,7 @@ int rt2x00lib_config_interface(struct ieee80211_hw *hw, int if_id,
 	struct ieee80211_if_conf *conf)
 {
 	struct rt2x00_dev *rt2x00dev = hw->priv;
+	struct interface *intf = &rt2x00dev->interface;
 
 	/*
 	 * Monitor mode does not need configuring.
@@ -488,7 +489,7 @@ int rt2x00lib_config_interface(struct ieee80211_hw *hw, int if_id,
 	 */
 	if (conf->type == IEEE80211_IF_TYPE_MNTR)
 		return 0;
-	else if (conf->type != rt2x00dev->interface.type)
+	else if (conf->type != intf->type)
 		return -EINVAL;
 
 	/*
@@ -497,13 +498,13 @@ int rt2x00lib_config_interface(struct ieee80211_hw *hw, int if_id,
 	 * should now be set.
 	 */
 	if (conf->type != IEEE80211_IF_TYPE_AP)
-		memcpy(&rt2x00dev->interface.bssid, conf->bssid, ETH_ALEN);
+		memcpy(&intf->bssid, conf->bssid, ETH_ALEN);
 
 	/*
 	 * Enable configuration.
 	 */
 	rt2x00dev->lib_ops->config_type(rt2x00dev, conf->type);
-	rt2x00dev->lib_ops->config_bssid(rt2x00dev, conf->bssid);
+	rt2x00dev->lib_ops->config_bssid(rt2x00dev, intf->bssid);
 
 	return 0;
 }

                 reply	other threads:[~2007-02-28 22:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200702282308.36935.IvDoorn@gmail.com \
    --to=ivdoorn@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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;
as well as URLs for NNTP newsgroup(s).