From: Johannes Berg <johannes@sipsolutions.net>
To: Michal Kazior <michal.kazior@tieto.com>
Cc: Kalle Valo <kvalo@qca.qualcomm.com>,
linux-wireless <linux-wireless@vger.kernel.org>,
Ben Greear <greearb@candelatech.com>,
"ath10k@lists.infradead.org" <ath10k@lists.infradead.org>,
Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
Subject: Re: [PATCH] ath10k: prevent sta pointer rcu violation
Date: Fri, 13 Jan 2017 08:24:12 +0100 [thread overview]
Message-ID: <1484292252.19860.5.camel@sipsolutions.net> (raw)
In-Reply-To: <CA+BoTQkgD5umVsGnRM4uu_8GO=KjQ6MuJCjQRnSHrDuQdU4z1w@mail.gmail.com> (sfid-20170112_171858_779498_B3B00B28)
> Unless you then continue to use that sta pointer after you release
> data_lock.
Ouch, ok. That's rather strangely hidden though.
> Consider this:
>
> > CPU0 CPU1
> > 1 synchronize_net()
> > 2 drv_sta_state()
> > 3 htt_fetch_ind(pid,tid) called
> > 4 rcu_read_lock()
> > 5 get(data_lock)
> > 6 txq=peers[pid]->sta->txq[tid]
> > 7 put(data_lock)
> > 8 get(data_lock)
> > 9 peer->sta=0
> > 10 put(data_lock)
> > 11 kfree(sta)
> > 12 ieee80211_tx_dequeue(txq)
>
> Even though there's no code like (9) per se you can think of it as
> anything that tries to "remove" the peer--sta association
> (ath10k_peer
> is removed implicitly via wmi peer delete command and waiting for htt
> event completion).
>
> Holding data_lock for the entire duration of handling fetch
> indication isn't really good for performance so it's better to fix
> RCU handling.
Yeah, I see it now - also the comment where this happens. You probably
should mark some things __rcu though and actually use RCU primitives,
so the code is actually understandable :)
johannes
_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k
next prev parent reply other threads:[~2017-01-13 7:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-12 15:14 [PATCH] ath10k: prevent sta pointer rcu violation Michal Kazior
2017-01-12 15:46 ` Johannes Berg
2017-01-12 16:18 ` Michal Kazior
2017-01-13 7:24 ` Johannes Berg [this message]
2017-01-13 8:32 ` Michal Kazior
2017-01-19 13:18 ` Kalle Valo
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=1484292252.19860.5.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=ath10k@lists.infradead.org \
--cc=greearb@candelatech.com \
--cc=kvalo@qca.qualcomm.com \
--cc=linux-wireless@vger.kernel.org \
--cc=michal.kazior@tieto.com \
--cc=mohammed@qti.qualcomm.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