Skip to contentSkip to conversation

brcmsmac: allocate ucode with GFP_KERNEL

PATCH In review Takashi Iwai 3 participants 3 messages Mar 16, 2018 – Mar 27, 2018 Broadcom BRCM80211 IEEE802.11 wireless drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 brcmsmac: allocate ucode with GFP_KERNEL

The brcms_ucode_init_buf() duplicates the ucode chunks via kmemdup() with GFP_ATOMIC as a precondition of wl->lock acquired. This caused allocation failures sometimes as reported in the bugzilla below.

When looking at the the real usage, one can find that it's called solely from brcms_request_fw(), and it's obviously outside the lock. Hence we can use GFP_KERNEL there safely for avoiding such allocation errors.

Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=1085174

---
 drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c +2 -2
index ddfdfe177e24..a14fccf8a902 100644
@@ -1563,7 +1563,7 @@ void brcms_free_timer(struct brcms_timer *t)
 }
 
 /*
- * precondition: perimeter lock has been acquired
+ * precondition: no locking required
  */
 int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, u32 idx)
 {
@@ -1578,7 +1578,7 @@ int brcms_ucode_init_buf(struct brcms_info *wl, void **pbuf, u32 idx)
 			if (le32_to_cpu(hdr->idx) == idx) {
 				pdata = wl->fw.fw_bin[i]->data +
 					le32_to_cpu(hdr->offset);
-				*pbuf = kmemdup(pdata, len, GFP_ATOMIC);
+				*pbuf = kmemdup(pdata, len, GFP_KERNEL);
 				if (*pbuf == NULL)
 					goto fail;
 
Signature · 1 line
2.16.2
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Takashi Iwai

The brcms_ucode_init_buf() duplicates the ucode chunks via kmemdup() with GFP_ATOMIC as a precondition of wl->lock acquired. This caused allocation failures sometimes as reported in the bugzilla below.

When looking at the the real usage, one can find that it's called solely from brcms_request_fw(), and it's obviously outside the lock. Hence we can use GFP_KERNEL there safely for avoiding such allocation errors.

Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=1085174

Quoted 5 lines
---
  drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
#2 lore raw
In reply to Takashi Iwai
Quoted 4 lines · Takashi Iwai

The brcms_ucode_init_buf() duplicates the ucode chunks via kmemdup() with GFP_ATOMIC as a precondition of wl->lock acquired. This caused allocation failures sometimes as reported in the bugzilla below.

Quoted 8 lines

When looking at the the real usage, one can find that it's called solely from brcms_request_fw(), and it's obviously outside the lock. Hence we can use GFP_KERNEL there safely for avoiding such allocation errors.

Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=1085174

Patch applied to wireless-drivers-next.git, thanks.

b1c2d0f2507b brcmsmac: allocate ucode with GFP_KERNEL

Signature · 3 lines
https://patchwork.kernel.org/patch/10288881/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches