All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>
To: linville@tuxdriver.com
Cc: netdev@vger.kernel.org
Subject: [PATCH] drivers/net/wireless/d80211: Check configuration type in hw->config_interface.
Date: Wed, 19 Jul 2006 22:26:52 +0200	[thread overview]
Message-ID: <44BE958C.4030401@6wind.com> (raw)

Hello,

This patch prevents a NULL pointer dereferencing in AP mode:
ieee80211_if_config will set conf->bssid only if device is of type STA 
or IBSS.
I see it using following commands right after module loading (with rt61)
# iwconfig wlan0 mode Master
# ifconfig wlan0 up


Signed-off-by: Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>


 adm8211/adm8211.c  |    4 +++-
 rt2x00/rt2400pci.c |    4 +++-
 rt2x00/rt2500pci.c |    4 +++-
 rt2x00/rt61pci.c   |    4 +++-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/d80211/adm8211/adm8211.c 
b/drivers/net/wireless/d80211/adm8211/adm8211.c
index 9fc5da7..53f05c2 100644
--- a/drivers/net/wireless/d80211/adm8211/adm8211.c
+++ b/drivers/net/wireless/d80211/adm8211/adm8211.c
@@ -1469,7 +1469,9 @@ static int adm8211_config_interface(stru
 {
     struct adm8211_priv *priv = ieee80211_dev_hw_data(dev);
 
-    if (memcmp(conf->bssid, priv->bssid, ETH_ALEN)) {
+    if ((conf->type == IEEE80211_IF_TYPE_STA ||
+         conf->type == IEEE80211_IF_TYPE_IBSS) &&
+         memcmp(conf->bssid, priv->bssid, ETH_ALEN)) {
         adm8211_set_bssid(dev, conf->bssid);
         memcpy(priv->bssid, conf->bssid, ETH_ALEN);
     }
diff --git a/drivers/net/wireless/d80211/rt2x00/rt2400pci.c 
b/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
index 946cf86..1d45851 100644
--- a/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
@@ -1877,7 +1877,9 @@ rt2400pci_config_interface(struct net_de
     if (rt2x00pci->type == IEEE80211_IF_TYPE_MNTR)
         return 0;
 
-    rt2400pci_config_bssid(rt2x00pci, conf->bssid);
+    if (conf->type == IEEE80211_IF_TYPE_STA ||
+        conf->type == IEEE80211_IF_TYPE_IBSS)
+        rt2400pci_config_bssid(rt2x00pci, conf->bssid);
 
     return 0;
 }
diff --git a/drivers/net/wireless/d80211/rt2x00/rt2500pci.c 
b/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
index ca0edd5..8d2b3a7 100644
--- a/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
@@ -2000,7 +2000,9 @@ rt2500pci_config_interface(struct net_de
     if (conf->type == IEEE80211_IF_TYPE_MNTR)
         return 0;
 
-    rt2500pci_config_bssid(rt2x00pci, conf->bssid);
+    if (conf->type == IEEE80211_IF_TYPE_STA ||
+        conf->type == IEEE80211_IF_TYPE_IBSS)
+        rt2500pci_config_bssid(rt2x00pci, conf->bssid);
 
     return 0;
 }
diff --git a/drivers/net/wireless/d80211/rt2x00/rt61pci.c 
b/drivers/net/wireless/d80211/rt2x00/rt61pci.c
index 0799f9f..47b2eaf 100644
--- a/drivers/net/wireless/d80211/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/d80211/rt2x00/rt61pci.c
@@ -2463,7 +2463,9 @@ rt61pci_config_interface(struct net_devi
     if (conf->type == IEEE80211_IF_TYPE_MNTR)
         return 0;
 
-    rt61pci_config_bssid(rt2x00pci, conf->bssid);
+    if (conf->type == IEEE80211_IF_TYPE_STA ||
+        conf->type == IEEE80211_IF_TYPE_IBSS)
+        rt61pci_config_bssid(rt2x00pci, conf->bssid);
 
     return 0;
 }



             reply	other threads:[~2006-07-19 20:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-19 20:26 Jean-Mickael Guerin [this message]
2006-07-19 21:13 ` drivers/net/wireless/d80211: Check configuration type in hw->config_interface Ivo Van Doorn
2006-07-19 22:05   ` Jean-Mickael Guerin
2006-07-20  1:07 ` [PATCH] " Michael Wu
2006-07-20  8:54   ` Jiri Benc
2006-07-20  8:46 ` Jiri Benc
2006-07-20 16:19   ` Ivo Van Doorn
2006-07-20 16:47     ` Ivo Van Doorn

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=44BE958C.4030401@6wind.com \
    --to=jean-mickael.guerin@6wind.com \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    /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 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.