linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@open-mesh.com>
To: Felix Fietkau <nbd@openwrt.org>, simon@open-mesh.com
Cc: linux-wireless@vger.kernel.org, johannes@sipsolutions.net,
	marek@open-mesh.com, Antonio Quartulli <antonio@open-mesh.com>
Subject: Re: [PATCH v6 2/3] mac80211/minstrel_ht: use the new rate control API
Date: Fri, 20 Feb 2015 15:12:10 +0100	[thread overview]
Message-ID: <2670025.E9NWYu3f4D@bentobox> (raw)
In-Reply-To: <1366640083-1054-2-git-send-email-nbd@openwrt.org>

Hi,

>  static void
> @@ -846,6 +857,8 @@ minstrel_ht_update_caps(void *priv, struct
> ieee80211_supported_band *sband,
> 
>  	msp->is_ht = true;
>  	memset(mi, 0, sizeof(*mi));
> +
> +	mi->sta = sta;
>  	mi->stats_update = jiffies;

minstrel_ht_update_caps can be called on init and on different other changes
(rate_control_rate_update).

Which lock protects mi from following scenario?

context 1: memset(mi, 0, sizeof(*mi)); // mi->sta is now NULL
context 2: minstrel_ht_update_rates -> rate_control_set_rates(mp->hw, mi->sta, rates)
context 2: rate_control_set_rates dereferences pubsta->rates (mi->sta + 0x48) -> Kernel Oops
context 1: mi->sta = sta

The first context is from one of the many rate_control_rate_update in mac80211
and the second context is from ieee80211_tx_status.

The question came up when discovering the OpenWrt bug report
 https://dev.openwrt.org/ticket/18388 (minstrel_ht_update_caps
the thing most likely behind minstrel_remove_sta_debugfs+0xe8c/0x1674 - at least
EPC is pointing inside this function for a build from this revision)

Kind regards,
	Sven Eckelmann

  reply	other threads:[~2015-02-20 14:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-22 14:14 [PATCH v6 1/3] mac80211: improve the rate control API Felix Fietkau
2013-04-22 14:14 ` [PATCH v6 2/3] mac80211/minstrel_ht: use the new " Felix Fietkau
2015-02-20 14:12   ` Sven Eckelmann [this message]
2015-02-25  9:35     ` Sven Eckelmann
2013-04-22 14:14 ` [PATCH v6 3/3] mac80211/minstrel: " Felix Fietkau
2013-04-22 14:18 ` [PATCH v6 1/3] mac80211: improve the " Johannes Berg
2013-04-22 15:51   ` Karl Beldan
2013-04-23  0:58 ` [PATCH] mac80211: fix spurious use of rcu_dereference Christian Lamparter
2013-04-23  6:48   ` Johannes Berg
2013-04-23 13:26     ` Christian Lamparter
2013-04-24 11:23       ` Johannes Berg

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=2670025.E9NWYu3f4D@bentobox \
    --to=sven@open-mesh.com \
    --cc=antonio@open-mesh.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=marek@open-mesh.com \
    --cc=nbd@openwrt.org \
    --cc=simon@open-mesh.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).