linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "John W. Linville" <linville@tuxdriver.com>
To: Dan Carpenter <error27@gmail.com>
Cc: nbd@openwrt.org, linux-wireless@vger.kernel.org,
	johannes@sipsolutions.net
Subject: Re: potential null deref in minstrel_ht_update_caps()?
Date: Thu, 22 Jul 2010 15:35:43 -0400	[thread overview]
Message-ID: <20100722193543.GF2616@tuxdriver.com> (raw)
In-Reply-To: <20100722110933.GA17585@bicker>

On Thu, Jul 22, 2010 at 01:09:33PM +0200, Dan Carpenter wrote:
> This is a smatch thing.
> 
> net/mac80211/rc80211_minstrel_ht.c +639 minstrel_ht_update_caps(15)
> 	warn: variable dereferenced before check 'sta'
>    631          struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
>    632          struct ieee80211_local *local = hw_to_local(mp->hw);
>    633          u16 sta_cap = sta->ht_cap.cap;
>                               ^^^^^^^^^^^^^^^
> 	Dereferenced here.
> 
>    634          int ack_dur;
>    635          int stbc;
>    636          int i;
>    637
>    638          /* fall back to the old minstrel for legacy stations */
>    639          if (sta && !sta->ht_cap.ht_supported) {
>                     ^^^
> 	Checked here.
> 
>    640                  msp->is_ht = false;
>    641                  memset(&msp->legacy, 0, sizeof(msp->legacy));
> 
> It seems like a bug, but I'm not sure how to deal with it.

I think that sta NULL check is unnecessary there.

John
-- 
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:[~2010-07-22 19:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-22 11:09 potential null deref in minstrel_ht_update_caps()? Dan Carpenter
2010-07-22 19:35 ` John W. Linville [this message]
2010-07-22 19:39 ` [PATCH] minstrel_ht: remove unnecessary NULL check in minstrel_ht_update_caps John W. Linville

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=20100722193543.GF2616@tuxdriver.com \
    --to=linville@tuxdriver.com \
    --cc=error27@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@openwrt.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 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).