linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
Cc: dan.carpenter@oracle.com, wfg@linux.intel.com,
	linux-wireless@vger.kernel.org, franzschrober@yahoo.de,
	julian.calaby@gmail.com, johannes@sipsolutions.net,
	nbd@openwrt.org
Subject: Re: [PATCH] mac80211: fix kzalloc memory corruption introduced in minstrel_ht
Date: Mon, 2 Jul 2012 14:25:17 -0400	[thread overview]
Message-ID: <20120702182517.GC2010@tuxdriver.com> (raw)
In-Reply-To: <1341232792-6247-1-git-send-email-thomas@net.t-labs.tu-berlin.de>

On Mon, Jul 02, 2012 at 02:39:52PM +0200, Thomas Huehn wrote:
> The patch: "mac80211: correct size the argument to
> kzalloc in minstrel_ht" (from Jun 29, 2012), leads to memory corruption.
> "msp->ratelist" is a void pointer - therfore going back to the
> expicit form: sizeof(struct minstrel_rate) which brings back correct
> memory allocation.
> 
> Reported-by: Fengguang Wu <wfg@linux.intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
> ---
>  net/mac80211/rc80211_minstrel_ht.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
> index 1ca8f2b..f9e51ef 100644
> --- a/net/mac80211/rc80211_minstrel_ht.c
> +++ b/net/mac80211/rc80211_minstrel_ht.c
> @@ -813,7 +813,7 @@ minstrel_ht_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
>  	if (!msp)
>  		return NULL;
>  
> -	msp->ratelist = kzalloc(sizeof(*msp->ratelist) * max_rates, gfp);
> +	msp->ratelist = kzalloc(sizeof(struct minstrel_rate) * max_rates, gfp);
>  	if (!msp->ratelist)
>  		goto error;
>  

Johannes, I'm grabbing this one now.

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

      reply	other threads:[~2012-07-05 14:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-02 12:39 [PATCH] mac80211: fix kzalloc memory corruption introduced in minstrel_ht Thomas Huehn
2012-07-02 18:25 ` John W. Linville [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=20120702182517.GC2010@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=dan.carpenter@oracle.com \
    --cc=franzschrober@yahoo.de \
    --cc=johannes@sipsolutions.net \
    --cc=julian.calaby@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@openwrt.org \
    --cc=thomas@net.t-labs.tu-berlin.de \
    --cc=wfg@linux.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;
as well as URLs for NNTP newsgroup(s).