All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac80211: Fix double locking on CSA counter update
@ 2015-06-01 13:54 Wojciech Dubowik
  2015-06-01 14:13 ` Julian Calaby
  0 siblings, 1 reply; 4+ messages in thread
From: Wojciech Dubowik @ 2015-06-01 13:54 UTC (permalink / raw)
  To: linux-wireless; +Cc: Wojciech Dubowik

We call rcu locked ieee80211_csa_update_counter from
already locked section. Fix it by decrementing counter
directly instead of calling ieee80211_csa_update_counter.

Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
---
 net/mac80211/tx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 8df1342..9233559 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3338,7 +3338,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw,
 		if (beacon) {
 			if (beacon->csa_counter_offsets[0]) {
 				if (!is_template)
-					ieee80211_csa_update_counter(vif);
+					WARN_ON_ONCE(beacon->csa_current_counter--);
 
 				ieee80211_set_csa(sdata, beacon);
 			}
@@ -3384,7 +3384,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw,
 
 		if (beacon->csa_counter_offsets[0]) {
 			if (!is_template)
-				ieee80211_csa_update_counter(vif);
+				WARN_ON_ONCE(beacon->csa_current_counter--);
 
 			ieee80211_set_csa(sdata, beacon);
 		}
@@ -3414,7 +3414,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw,
 				 * for now we leave it consistent with overall
 				 * mac80211's behavior.
 				 */
-				ieee80211_csa_update_counter(vif);
+				WARN_ON_ONCE(beacon->csa_current_counter--);
 
 			ieee80211_set_csa(sdata, beacon);
 		}
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mac80211: Fix double locking on CSA counter update
  2015-06-01 13:54 [PATCH] mac80211: Fix double locking on CSA counter update Wojciech Dubowik
@ 2015-06-01 14:13 ` Julian Calaby
  2015-06-01 14:23   ` Wojciech Dubowik
  0 siblings, 1 reply; 4+ messages in thread
From: Julian Calaby @ 2015-06-01 14:13 UTC (permalink / raw)
  To: Wojciech Dubowik; +Cc: linux-wireless

Hi Wojciech,

On Mon, Jun 1, 2015 at 11:54 PM, Wojciech Dubowik
<Wojciech.Dubowik@neratec.com> wrote:
> We call rcu locked ieee80211_csa_update_counter from
> already locked section. Fix it by decrementing counter
> directly instead of calling ieee80211_csa_update_counter.

Stupid question: wouldn't it be better to split the work from
ieee80211_csa_update_counter() into a separate function without
locking and call that instead?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mac80211: Fix double locking on CSA counter update
  2015-06-01 14:13 ` Julian Calaby
@ 2015-06-01 14:23   ` Wojciech Dubowik
  2015-06-01 14:40     ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Wojciech Dubowik @ 2015-06-01 14:23 UTC (permalink / raw)
  To: Julian Calaby; +Cc: linux-wireless

On 01/06/15 16:13, Julian Calaby wrote:
> Hi Wojciech,
>
> On Mon, Jun 1, 2015 at 11:54 PM, Wojciech Dubowik
> <Wojciech.Dubowik@neratec.com> wrote:
>> We call rcu locked ieee80211_csa_update_counter from
>> already locked section. Fix it by decrementing counter
>> directly instead of calling ieee80211_csa_update_counter.
> Stupid question: wouldn't it be better to split the work from
> ieee80211_csa_update_counter() into a separate function without
> locking and call that instead?
Yes. It would be better for maintenance. It's just that they will
have different input parameters

ieee80211_csa_update_counter(struct ieee80211_vif *
__ieee80211_csa_update_counter(struct beacon_data *

as it doesn't make sense to dereference beacon twice.

I guess it's not a problem?
Wojtek
>
> Thanks,
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mac80211: Fix double locking on CSA counter update
  2015-06-01 14:23   ` Wojciech Dubowik
@ 2015-06-01 14:40     ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2015-06-01 14:40 UTC (permalink / raw)
  To: Wojciech Dubowik; +Cc: Julian Calaby, linux-wireless

On Mon, 2015-06-01 at 16:23 +0200, Wojciech Dubowik wrote:
> On 01/06/15 16:13, Julian Calaby wrote:
> > Hi Wojciech,
> >
> > On Mon, Jun 1, 2015 at 11:54 PM, Wojciech Dubowik
> > <Wojciech.Dubowik@neratec.com> wrote:
> >> We call rcu locked ieee80211_csa_update_counter from
> >> already locked section. Fix it by decrementing counter
> >> directly instead of calling ieee80211_csa_update_counter.
> > Stupid question: wouldn't it be better to split the work from
> > ieee80211_csa_update_counter() into a separate function without
> > locking and call that instead?
> Yes. It would be better for maintenance. It's just that they will
> have different input parameters
> 
> ieee80211_csa_update_counter(struct ieee80211_vif *
> __ieee80211_csa_update_counter(struct beacon_data *
> 
> as it doesn't make sense to dereference beacon twice.
> 
> I guess it's not a problem?

Seems fine to me.

johannes


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-01 14:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-01 13:54 [PATCH] mac80211: Fix double locking on CSA counter update Wojciech Dubowik
2015-06-01 14:13 ` Julian Calaby
2015-06-01 14:23   ` Wojciech Dubowik
2015-06-01 14:40     ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.