Skip to contentSkip to conversation

drivers:net:wireless: Add proper locking for the function, b43_op_beacon_set_tim in main.c

PATCH In review Nicholas Krause 5 participants 10 messages Jan 2, 2015 – Jan 5, 2015 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers:net:wireless: Add proper locking for the function, b43_op_beacon_set_tim in main.c

This adds proper locking for the function, b43_op_beacon_set_tim in main.c by using the mutex lock in the structure pointer wl, as embedded into this pointer as a mutex in order to protect against multiple access to the pointer wl when updating the templates for this pointer in the function, b43_update_templates internally in the function, b43_op_beacon_set_tim.

---
 drivers/net/wireless/b43/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/b43/main.c +2 -1
index 47731cb..d568fc8 100644
@@ -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;
 }
Signature · 1 line
2.1.0
#1 lore raw
Quoted 15 lines · On Fri, 2 Jan 2015 02:34:01 -0500 Nicholas Krause <[email protected]> wrote:

This adds proper locking for the function, b43_op_beacon_set_tim in main.c by using the mutex lock in the structure pointer wl, as embedded into this pointer as a mutex in order to protect against multiple access to the pointer wl when updating the templates for this pointer in the function, b43_update_templates internally in the function, b43_op_beacon_set_tim.

---
 drivers/net/wireless/b43/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/b43/main.c +0 -0
index 47731cb..d568fc8 100644

drivers/net/wireless/b43/main.c static int b43_op_beacon_set_tim(struct ieee80211_hw *hw, · line 5102

Quoted 10 lines
drivers/net/wireless/b43/main.c +2 -1
@@ -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;
 }

Thanks for the patch.

However, this does not work. We are in atomic context here.
Please see the b43-dev mailing list archives for a recent thread about that.
I'm also pretty sure that this is safe without lock, due to the higher level locks in mac80211.

Signature · 8 lines
Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/b43-dev/attachments/20150102/38ecd737/attachment.sig>
#2 lore raw
Quoted 26 lines · Michael B?sch
Quoted 23 lines · On Fri, 2 Jan 2015 02:34:01 -0500 Nicholas Krause <[email protected]> wrote:

This adds proper locking for the function, b43_op_beacon_set_tim in main.c by using the mutex lock in the structure pointer wl, as embedded into this pointer as a mutex in order to protect against multiple access to the pointer wl when updating the templates for this pointer in the function, b43_update_templates internally in the function, b43_op_beacon_set_tim.

---
 drivers/net/wireless/b43/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/b43/main.c +2 -1
index 47731cb..d568fc8 100644
@@ -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);
 
Quoted 7 lines

drivers/net/wireless/b43/main.c static int b43_op_beacon_set_tim(struct ieee80211_hw *hw, · line 5102

Quoted 2 lines
drivers/net/wireless/b43/main.c +0 -0
      return 0;
 }

Thanks for the patch.

However, this does not work. We are in atomic context here. Please see the b43-dev mailing list archives for a recent thread about that.

Michael: guess who it was who sent the patch doing the same back in November.

Yes, the same troll.

Signature · 1 line
Rafa?
#3 lore raw
Quoted 32 lines · On Fri, 2 Jan 2015 12:19:12 +0100 Rafa? Mi?ecki <[email protected]> wrote:
Quoted 31 lines · Michael B?sch
Quoted 15 lines · On Fri, 2 Jan 2015 02:34:01 -0500 Nicholas Krause <[email protected]> wrote:

This adds proper locking for the function, b43_op_beacon_set_tim in main.c by using the mutex lock in the structure pointer wl, as embedded into this pointer as a mutex in order to protect against multiple access to the pointer wl when updating the templates for this pointer in the function, b43_update_templates internally in the function, b43_op_beacon_set_tim.

---
 drivers/net/wireless/b43/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/b43/main.c +0 -0
index 47731cb..d568fc8 100644

drivers/net/wireless/b43/main.c static int b43_op_beacon_set_tim(struct ieee80211_hw *hw, · line 5102

Quoted 10 lines
drivers/net/wireless/b43/main.c +2 -1
@@ -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;
 }

Thanks for the patch.

Quoted 6 lines
Quoted 2 lines

However, this does not work. We are in atomic context here. Please see the b43-dev mailing list archives for a recent thread about that.

Michael: guess who it was who sent the patch doing the same back in November.

Yes, the same troll.

D'oh.
Thanks for the notice.

Signature · 8 lines
Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/b43-dev/attachments/20150102/aa3e18d8/attachment.sig>
author
#4 lore raw
In reply to Michael Büsch

Michael,
My fault I wasn't aware we were in atomic context, however if we are then why not just remove the comment. If you want I can send in a patch explaining why this comment is no longer needed.
Regards,
Nick

Quoted 35 lines · Michael B?sch
Quoted 15 lines · On Fri, 2 Jan 2015 02:34:01 -0500 Nicholas Krause <[email protected]> wrote:

This adds proper locking for the function, b43_op_beacon_set_tim in main.c by using the mutex lock in the structure pointer wl, as embedded into this pointer as a mutex in order to protect against multiple access to the pointer wl when updating the templates for this pointer in the function, b43_update_templates internally in the function, b43_op_beacon_set_tim.

---
 drivers/net/wireless/b43/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/b43/main.c +0 -0
index 47731cb..d568fc8 100644

drivers/net/wireless/b43/main.c static int b43_op_beacon_set_tim(struct ieee80211_hw *hw, · line 5102

Quoted 10 lines
drivers/net/wireless/b43/main.c +2 -1
@@ -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;
 }

Thanks for the patch.

However, this does not work. We are in atomic context here.
Please see the b43-dev mailing list archives for a recent thread about that.
I'm also pretty sure that this is safe without lock, due to the higher level locks in mac80211.

#5 lore raw
In reply to Nicholas Krause
Quoted 6 lines · Nicholas Krause

This adds proper locking for the function, b43_op_beacon_set_tim in main.c by using the mutex lock in the structure pointer wl, as embedded into this pointer as a mutex in order to protect against multiple access to the pointer wl when updating the templates for this pointer in the function, b43_update_templates internally in the function, b43_op_beacon_set_tim.

Although this patch has already been rejected, I want to comment on the subject you have chosen. As you are submitting it to the maintainer of drivers/net/wireless/, there is no need to place those entities in the subject. A better subject would have been "b43: Add proper locking for b43_op_beacon_set_tim()".

Larry

#6 lore raw
In reply to Nicholas Krause
Quoted 8 lines · Nicholas Krause

This adds proper locking for the function, b43_op_beacon_set_tim in main.c by using the mutex lock in the structure pointer wl, as embedded into this pointer as a mutex in order to protect against multiple access to the pointer wl when updating the templates for this pointer in the function, b43_update_templates internally in the function, b43_op_beacon_set_tim.

Based on the discussion I have dropped this patch.

Signature · 1 line
Kalle Valo

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#8 lore raw

Kalle,
That's fine. On the other hand I am interested in the reasons why this patch was dropped so I can send in a version 2 of this patch.
Regards Nick

Quoted 13 lines · Kalle Valo
Quoted 8 lines · Nicholas Krause

This adds proper locking for the function, b43_op_beacon_set_tim in main.c by using the mutex lock in the structure pointer wl, as embedded into this pointer as a mutex in order to protect against multiple access to the pointer wl when updating the templates for this pointer in the function, b43_update_templates internally in the function, b43_op_beacon_set_tim.

Based on the discussion I have dropped this patch.

#9 lore raw
Quoted 5 lines · nick

Kalle,
That's fine. On the other hand I am interested in the reasons why this patch was dropped so I can send in a version 2 of this patch.
Regards Nick

Apparently you missed Michael B?sch's comment:

"Thanks for the patch.

However, this does not work. We are in atomic context here. Please see the b43-dev mailing list archives for a recent thread about that. I'm also pretty sure that this is safe without lock, due to the higher level locks in mac80211."

Did you actually test the patch? If Michael is right, and I trust him on this matter, your patch should lock the system.

Larry

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#11 lore raw

Larry,
Your right I build tested it. Unfortunately I don't have the hardware.
Regards Nick

Quoted 19 lines · Larry Finger
Quoted 5 lines · nick

Kalle,
That's fine. On the other hand I am interested in the reasons why this patch was dropped so I can send in a version 2 of this patch.
Regards Nick

Apparently you missed Michael B?sch's comment:

"Thanks for the patch.

However, this does not work. We are in atomic context here.
Please see the b43-dev mailing list archives for a recent thread about that.
I'm also pretty sure that this is safe without lock, due to the higher level locks in mac80211."

Did you actually test the patch? If Michael is right, and I trust him on this matter, your patch should lock the system.

Larry