From: Christian Lamparter <chunkeey@googlemail.com>
To: Amit SHAKYA <amit.shakya@stericsson.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
"John W. Linville" <linville@tuxdriver.com>,
"linux-wireless" <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] mac80211: Fix PN corruption in case of multiple virtual interface
Date: Wed, 6 Feb 2013 14:33:19 +0100 [thread overview]
Message-ID: <201302061433.19375.chunkeey@googlemail.com> (raw)
In-Reply-To: <ECD438FDEF6BD742895E554C24725A40236E82519C@EXDCVYMBSTM005.EQ1STM.local>
On Wednesday, February 06, 2013 07:56:46 AM Amit SHAKYA wrote:
> From: Johannes Berg [mailto:johannes@sipsolutions.net]
> On Mon, 2013-02-04 at 16:48 +0530, Amit Shakya wrote:
> > @@ -2790,7 +2791,20 @@ static void ieee80211_rx_handlers(struct
> > ieee80211_rx_data *rx)
> >
> > rx->local->running_rx_handler = true;
> >
> > - while ((skb = __skb_dequeue(&rx->local->rx_skb_queue))) {
> > + skb_queue_walk_safe(&rx->local->rx_skb_queue, skb, tmp) {
> > + if (!skb)
> > + break;
> > + hdr = (struct ieee80211_hdr *) skb->data;
> > + /*
> > + * Additional check to ensure that the packets corresponding
> > + * to same sta entry as in rx->sta are de-queued. The queue
> > + * can have different interface packets in case of multiple vifs
> > + */
> > + if ((rx->sta && hdr) && (ieee80211_is_data(hdr->frame_control))
> > + && (memcmp(rx->sta->sta.addr, hdr->addr2, ETH_ALEN)))
> > + continue;
> > + __skb_unlink(skb, &rx->local->rx_skb_queue);
> I wonder if this could lead to leaking frames here, if the station
> disconnects or something while there are frames for it on the queue?
> IOW, the "just skip that frame" piece seems a bit questionable.
>
>[AS] BTW we did test this out and didn’t observe any such issue. Can you
> please help me understand the flow which could lead to the same?
I read it like this: If a station suddenly disappears (for good) while
it still has some data in the reorder buffer, the reorder release timer
will put these orphaned frames into rx_skb_queue.
With this patch, they will never be cleared from the queue, until
ieee80211_unregister_hw is called [when the device is unregistered].
So, you would need to go through the rx_skb_queue everytime a HT
station is torn down and remove the affected frames from there.
> Also in case this is an issue, can we take care of this in the cleanup
> related to disconnect?
Sure, you could do that in ieee80211_sta_tear_down_BA_sessions. But you
don't need to. On Monday, I posted a patch:
<http://www.spinics.net/lists/linux-wireless/msg102725.html>
it should take care of the issue. So, can you test it please?
> Here it seems a conscious effort has been made to avoid spinlock
> (rx->local->rx_skb_queue.lock), as this lock is taken only for the
> duration of dequeue. The suggested solution avoids using spinlock.
Oh no, the locking is there. skb_unlink is defined in net/core/skbuff.c
as a spin_lock wrapped __skb_unlink. The same is true for skb_queue_tail
and __skb_queue_tail. (Or are you talking about something else?)
Regards
Christian
next prev parent reply other threads:[~2013-02-06 13:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-04 11:18 [PATCH] mac80211: Fix PN corruption in case of multiple virtual interface Amit Shakya
2013-02-04 15:28 ` Johannes Berg
2013-02-04 17:14 ` Christian Lamparter
2013-02-04 17:30 ` Johannes Berg
2013-02-04 17:44 ` Christian Lamparter
2013-02-04 17:55 ` Johannes Berg
2013-02-06 5:50 ` Amit SHAKYA
2013-02-06 6:56 ` Amit SHAKYA
2013-02-06 13:33 ` Christian Lamparter [this message]
2013-02-08 7:10 ` Amit SHAKYA
2013-02-08 8:50 ` Johannes Berg
2013-02-08 15:02 ` Ben Greear
[not found] ` <E1U3pik-0005vi-Jv@debian64.localnet>
2013-02-08 21:36 ` [PATCH] mac80211: protect rx-path with spinlock Johannes Berg
2013-02-08 21:45 ` Christian Lamparter
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=201302061433.19375.chunkeey@googlemail.com \
--to=chunkeey@googlemail.com \
--cc=amit.shakya@stericsson.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.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).