aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhu Yi <yi.zhu@intel.com>2009-07-09 04:59:49 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-24 15:05:09 -0400
commit80e5b06a1b0d9a6aa88dc5c9e93ba49510c52b45 (patch)
tree08adf2317a7c57d7ee12b60375a40a4865d39a5f
parentf874011bb01e7fb19904db7f739bb343a0a53fd5 (diff)
cfg80211: fix NULL dereference in IBSS SIOCGIWAP
This patch avoids memcpy from wdev->wext.ibss.bssid if it is NULL. This could happen if we SIOCGIWAP before SIOCSIWAP. Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--net/wireless/ibss.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index 9394e78cd11f..8b65e212ae49 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -487,8 +487,11 @@ int cfg80211_ibss_wext_giwap(struct net_device *dev,
487 wdev_lock(wdev); 487 wdev_lock(wdev);
488 if (wdev->current_bss) 488 if (wdev->current_bss)
489 memcpy(ap_addr->sa_data, wdev->current_bss->pub.bssid, ETH_ALEN); 489 memcpy(ap_addr->sa_data, wdev->current_bss->pub.bssid, ETH_ALEN);
490 else 490 else if (wdev->wext.ibss.bssid)
491 memcpy(ap_addr->sa_data, wdev->wext.ibss.bssid, ETH_ALEN); 491 memcpy(ap_addr->sa_data, wdev->wext.ibss.bssid, ETH_ALEN);
492 else
493 memset(ap_addr->sa_data, 0, ETH_ALEN);
494
492 wdev_unlock(wdev); 495 wdev_unlock(wdev);
493 496
494 return 0; 497 return 0;