public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Zhu Yi <yi.zhu@intel.com>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org
Subject: Re: [PATCH] cfg80211: fix NULL dereference in IBSS SIOCGIWAP
Date: Thu, 09 Jul 2009 13:32:06 +0200	[thread overview]
Message-ID: <1247139126.2144.17.camel@johannes.local> (raw)
In-Reply-To: <1247129989-24989-1-git-send-email-yi.zhu@intel.com>

[-- Attachment #1: Type: text/plain, Size: 965 bytes --]

On Thu, 2009-07-09 at 16:59 +0800, Zhu Yi wrote:
> This patch avoids memcpy from wdev->wext.ibss.bssid if it is NULL.
> This could happen if we SIOCGIWAP before SIOCSIWAP.

Indeed, thanks.

> Signed-off-by: Zhu Yi <yi.zhu@intel.com>

Reviewed-by: Johannes Berg <johannes@sipsolutions.net>

> ---
>  net/wireless/ibss.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
> index 99ef936..cf3a7dc 100644
> --- a/net/wireless/ibss.c
> +++ b/net/wireless/ibss.c
> @@ -434,8 +434,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;

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

      reply	other threads:[~2009-07-09 11:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-09  8:59 [PATCH] cfg80211: fix NULL dereference in IBSS SIOCGIWAP Zhu Yi
2009-07-09 11:32 ` Johannes Berg [this message]

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=1247139126.2144.17.camel@johannes.local \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=yi.zhu@intel.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