* [PATCH] drivers:net:wireless: Add mutex locking for function, b43_op_beacon_set_time in main.c
@ 2014-11-28 22:16 Nicholas Krause
2014-11-28 22:40 ` Rafał Miłecki
0 siblings, 1 reply; 9+ messages in thread
From: Nicholas Krause @ 2014-11-28 22:16 UTC (permalink / raw)
To: stefano.brivio-hl5o88x/ua9eoWH0uzbU5w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
b43-dev-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Adds needed mutex lockng of wl->mutex in order to prevent issues with separate threads executing on
the b43_update_templates function call in the function, b43_op_beacon_set_time at the same time.
Signed-off-by: Nicholas Krause <xerofoify-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/net/wireless/b43/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 5d4173e..19ddc72 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -5094,8 +5094,9 @@ static int b43_op_beacon_set_tim(struct ieee80211_hw *hw,
{
struct b43_wl *wl = hw_to_b43_wl(hw);
- /* FIXME: add locking */
+ mutex_lock(&wl->mutex);
b43_update_templates(wl);
+ mutex_unlock(&wl->mutex);
return 0;
}
--
2.1.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH] drivers:net:wireless: Add mutex locking for function, b43_op_beacon_set_time in main.c
2014-11-28 22:16 [PATCH] drivers:net:wireless: Add mutex locking for function, b43_op_beacon_set_time in main.c Nicholas Krause
@ 2014-11-28 22:40 ` Rafał Miłecki
2014-11-28 23:21 ` Michael Büsch
0 siblings, 1 reply; 9+ messages in thread
From: Rafał Miłecki @ 2014-11-28 22:40 UTC (permalink / raw)
To: Nicholas Krause, Michael Büsch
Cc: Stefano Brivio, Network Development,
linux-wireless@vger.kernel.org, Linux Kernel Mailing List,
b43-dev
On 28 November 2014 at 23:16, Nicholas Krause <xerofoify@gmail.com> wrote:
> Adds needed mutex lockng of wl->mutex in order to prevent issues with separate threads executing on
> the b43_update_templates function call in the function, b43_op_beacon_set_time at the same time.
For all kind of kernel documentation / descriptions we try to fit 72
chars limit and we really try to avoid exceeding 80 chars.
> @@ -5094,8 +5094,9 @@ static int b43_op_beacon_set_tim(struct ieee80211_hw *hw,
> {
> struct b43_wl *wl = hw_to_b43_wl(hw);
>
> - /* FIXME: add locking */
> + mutex_lock(&wl->mutex);
> b43_update_templates(wl);
> + mutex_unlock(&wl->mutex);
>
> return 0;
> }
Does anyone remember why this simple solution wasn't implemented
earlier? Michael?
Nicholas: did you test it anyhow?
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] drivers:net:wireless: Add mutex locking for function, b43_op_beacon_set_time in main.c
2014-11-28 22:40 ` Rafał Miłecki
@ 2014-11-28 23:21 ` Michael Büsch
2014-11-29 3:32 ` nick
0 siblings, 1 reply; 9+ messages in thread
From: Michael Büsch @ 2014-11-28 23:21 UTC (permalink / raw)
To: Rafał Miłecki
Cc: Nicholas Krause, Stefano Brivio, Network Development,
linux-wireless@vger.kernel.org, Linux Kernel Mailing List,
b43-dev
[-- Attachment #1: Type: text/plain, Size: 627 bytes --]
On Fri, 28 Nov 2014 23:40:46 +0100
Rafał Miłecki <zajec5@gmail.com> wrote:
> > @@ -5094,8 +5094,9 @@ static int b43_op_beacon_set_tim(struct ieee80211_hw *hw,
> > {
> > struct b43_wl *wl = hw_to_b43_wl(hw);
> >
> > - /* FIXME: add locking */
> > + mutex_lock(&wl->mutex);
> > b43_update_templates(wl);
> > + mutex_unlock(&wl->mutex);
> >
> > return 0;
> > }
>
> Does anyone remember why this simple solution wasn't implemented
> earlier? Michael?
I think the callback used to be (is?) in atomic context.
> Nicholas: did you test it anyhow?
--
Michael
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] drivers:net:wireless: Add mutex locking for function, b43_op_beacon_set_time in main.c
2014-11-28 23:21 ` Michael Büsch
@ 2014-11-29 3:32 ` nick
2014-11-29 8:54 ` Rafał Miłecki
2014-11-29 8:56 ` Michael Büsch
0 siblings, 2 replies; 9+ messages in thread
From: nick @ 2014-11-29 3:32 UTC (permalink / raw)
To: Michael Büsch, Rafał Miłecki
Cc: Network Development,
linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Linux Kernel Mailing List, Stefano Brivio, b43-dev
Michael,
I don't have hardware for this driver on me, so I didn't test it. However this seems to
be correct from my reading of the code around this function and other locking related
to this driver.
Cheers Nick
On 2014-11-28 06:21 PM, Michael Büsch wrote:
> On Fri, 28 Nov 2014 23:40:46 +0100
> Rafał Miłecki <zajec5@gmail.com> wrote:
>
>>> @@ -5094,8 +5094,9 @@ static int b43_op_beacon_set_tim(struct ieee80211_hw *hw,
>>> {
>>> struct b43_wl *wl = hw_to_b43_wl(hw);
>>>
>>> - /* FIXME: add locking */
>>> + mutex_lock(&wl->mutex);
>>> b43_update_templates(wl);
>>> + mutex_unlock(&wl->mutex);
>>>
>>> return 0;
>>> }
>>
>> Does anyone remember why this simple solution wasn't implemented
>> earlier? Michael?
>
> I think the callback used to be (is?) in atomic context.
>
>> Nicholas: did you test it anyhow?
>
_______________________________________________
b43-dev mailing list
b43-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/b43-dev
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH] drivers:net:wireless: Add mutex locking for function, b43_op_beacon_set_time in main.c
2014-11-29 3:32 ` nick
@ 2014-11-29 8:54 ` Rafał Miłecki
2014-11-29 8:56 ` Michael Büsch
1 sibling, 0 replies; 9+ messages in thread
From: Rafał Miłecki @ 2014-11-29 8:54 UTC (permalink / raw)
To: nick
Cc: Michael Büsch, Stefano Brivio, Network Development,
linux-wireless@vger.kernel.org, Linux Kernel Mailing List,
b43-dev
On 29 November 2014 at 04:32, nick <xerofoify@gmail.com> wrote:
> I don't have hardware for this driver on me, so I didn't test it. However this seems to
> be correct from my reading of the code around this function and other locking related
> to this driver.
So do you say it's not executed in an atomic?
>From *early* look it seems b43_update_templates is called from
b43_op_beacon_set_tim and b43_op_bss_info_changed, both or them are
mac80211 callbacks. That also should be safe, however I didn't check
if it may conflict with some in-kernel code (still, assuming it's not
atomic code, which I don't know!).
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drivers:net:wireless: Add mutex locking for function, b43_op_beacon_set_time in main.c
2014-11-29 3:32 ` nick
2014-11-29 8:54 ` Rafał Miłecki
@ 2014-11-29 8:56 ` Michael Büsch
2014-11-29 9:04 ` Rafał Miłecki
1 sibling, 1 reply; 9+ messages in thread
From: Michael Büsch @ 2014-11-29 8:56 UTC (permalink / raw)
To: nick
Cc: Rafał Miłecki, Stefano Brivio, Network Development,
linux-wireless@vger.kernel.org, Linux Kernel Mailing List,
b43-dev
[-- Attachment #1: Type: text/plain, Size: 503 bytes --]
On Fri, 28 Nov 2014 22:32:30 -0500
nick <xerofoify@gmail.com> wrote:
> I don't have hardware for this driver on me, so I didn't test it. However this seems to
> be correct from my reading of the code around this function and other locking related
> to this driver.
From the current docs:
> * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
> * must be set or cleared for a given STA. Must be atomic.
So it is not allowed to lock a mutex here.
--
Michael
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] drivers:net:wireless: Add mutex locking for function, b43_op_beacon_set_time in main.c
2014-11-29 8:56 ` Michael Büsch
@ 2014-11-29 9:04 ` Rafał Miłecki
[not found] ` <CACna6ryjZ-LY06wAMzoL77Wca3McUUT+VYsO4EPO87NqjBnaNw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Rafał Miłecki @ 2014-11-29 9:04 UTC (permalink / raw)
To: Michael Büsch
Cc: nick, Stefano Brivio, Network Development,
linux-wireless@vger.kernel.org, Linux Kernel Mailing List,
b43-dev
On 29 November 2014 at 09:56, Michael Büsch <m@bues.ch> wrote:
> On Fri, 28 Nov 2014 22:32:30 -0500
> nick <xerofoify@gmail.com> wrote:
>
>> I don't have hardware for this driver on me, so I didn't test it. However this seems to
>> be correct from my reading of the code around this function and other locking related
>> to this driver.
>
> From the current docs:
>
>> * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
>> * must be set or cleared for a given STA. Must be atomic.
>
> So it is not allowed to lock a mutex here.
Nicholas please be more careful with your patches. It seems your patch
is wrong, you didn't check the docs and you didn't even say in the
first place that it wasn't tested. You could at least submit with with
RFT tag or sth.
--
Rafał
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-11-29 18:54 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-28 22:16 [PATCH] drivers:net:wireless: Add mutex locking for function, b43_op_beacon_set_time in main.c Nicholas Krause
2014-11-28 22:40 ` Rafał Miłecki
2014-11-28 23:21 ` Michael Büsch
2014-11-29 3:32 ` nick
2014-11-29 8:54 ` Rafał Miłecki
2014-11-29 8:56 ` Michael Büsch
2014-11-29 9:04 ` Rafał Miłecki
[not found] ` <CACna6ryjZ-LY06wAMzoL77Wca3McUUT+VYsO4EPO87NqjBnaNw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-29 18:09 ` nick
[not found] ` <547A0BC5.2080005-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-29 18:54 ` Larry Finger
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).