Skip to content

Commit

Permalink
cfg80211: fix NULL dereference in IBSS SIOCGIWAP
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Zhu Yi authored and John W. Linville committed Jul 24, 2009
1 parent f874011 commit 80e5b06
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/wireless/ibss.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,11 @@ int cfg80211_ibss_wext_giwap(struct net_device *dev,
wdev_lock(wdev);
if (wdev->current_bss)
memcpy(ap_addr->sa_data, wdev->current_bss->pub.bssid, ETH_ALEN);
else
else if (wdev->wext.ibss.bssid)
memcpy(ap_addr->sa_data, wdev->wext.ibss.bssid, ETH_ALEN);
else
memset(ap_addr->sa_data, 0, ETH_ALEN);

wdev_unlock(wdev);

return 0;
Expand Down

0 comments on commit 80e5b06

Please sign in to comment.