<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/net/wireless/broadcom, branch v4.9.210</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>brcmsmac: never log "tid x is not agg'able" by default</title>
<updated>2019-11-28T17:28:56+00:00</updated>
<author>
<name>Ali MJ Al-Nasrawy</name>
<email>alimjalnasrawy@gmail.com</email>
</author>
<published>2018-10-23T16:12:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=4b3a1f75e29da548d0c52e3322b51f21e2a1d3c1'/>
<id>4b3a1f75e29da548d0c52e3322b51f21e2a1d3c1</id>
<content type='text'>
[ Upstream commit 96fca788e5788b7ea3b0050eb35a343637e0a465 ]

This message greatly spams the log under heavy Tx of frames with BK access
class which is especially true when operating as AP. It is also not informative
as the "agg'ablity" of TIDs are set once and never change.
Fix this by logging only in debug mode.

Signed-off-by: Ali MJ Al-Nasrawy &lt;alimjalnasrawy@gmail.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 96fca788e5788b7ea3b0050eb35a343637e0a465 ]

This message greatly spams the log under heavy Tx of frames with BK access
class which is especially true when operating as AP. It is also not informative
as the "agg'ablity" of TIDs are set once and never change.
Fix this by logging only in debug mode.

Signed-off-by: Ali MJ Al-Nasrawy &lt;alimjalnasrawy@gmail.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>brcmsmac: AP mode: update beacon when TIM changes</title>
<updated>2019-11-28T17:28:19+00:00</updated>
<author>
<name>Ali MJ Al-Nasrawy</name>
<email>alimjalnasrawy@gmail.com</email>
</author>
<published>2018-10-03T16:21:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=7d6d2d93fa0af180eaa99eaeb9557efcc4ae94f4'/>
<id>7d6d2d93fa0af180eaa99eaeb9557efcc4ae94f4</id>
<content type='text'>
[ Upstream commit 2258ee58baa554609a3cc3996276e4276f537b6d ]

Beacons are not updated to reflect TIM changes. This is not compliant with
power-saving client stations as the beacons do not have valid TIM and can
cause the network to stall at random occasions and to have highly variable
latencies.
Fix it by updating beacon templates on mac80211 set_tim callback.

Addresses an issue described in:
https://marc.info/?i=20180911163534.21312d08%20()%20manjaro

Signed-off-by: Ali MJ Al-Nasrawy &lt;alimjalnasrawy@gmail.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 2258ee58baa554609a3cc3996276e4276f537b6d ]

Beacons are not updated to reflect TIM changes. This is not compliant with
power-saving client stations as the beacons do not have valid TIM and can
cause the network to stall at random occasions and to have highly variable
latencies.
Fix it by updating beacon templates on mac80211 set_tim callback.

Addresses an issue described in:
https://marc.info/?i=20180911163534.21312d08%20()%20manjaro

Signed-off-by: Ali MJ Al-Nasrawy &lt;alimjalnasrawy@gmail.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>brcmfmac: fix full timeout waiting for action frame on-channel tx</title>
<updated>2019-11-25T08:53:33+00:00</updated>
<author>
<name>Chung-Hsien Hsu</name>
<email>stanley.hsu@cypress.com</email>
</author>
<published>2018-09-27T14:59:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=3b18e33c08a598e50d8875b18e13ddb729c2648e'/>
<id>3b18e33c08a598e50d8875b18e13ddb729c2648e</id>
<content type='text'>
[ Upstream commit fbf07000960d9c8a13fdc17c6de0230d681c7543 ]

The driver sends an action frame down and waits for a completion signal
triggered by the received BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE event
to continue the process. However, the action frame could be transmitted
either on the current channel or on an off channel. For the on-channel
case, only BRCMF_E_ACTION_FRAME_COMPLETE event will be received when
the frame is transmitted, which make the driver always wait a full
timeout duration. This patch has the completion signal be triggered by
receiving the BRCMF_E_ACTION_FRAME_COMPLETE event for the on-channel
case.

This change fixes WFA p2p certification 5.1.19 failure.

Signed-off-by: Chung-Hsien Hsu &lt;stanley.hsu@cypress.com&gt;
Signed-off-by: Chi-Hsien Lin &lt;chi-hsien.lin@cypress.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit fbf07000960d9c8a13fdc17c6de0230d681c7543 ]

The driver sends an action frame down and waits for a completion signal
triggered by the received BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE event
to continue the process. However, the action frame could be transmitted
either on the current channel or on an off channel. For the on-channel
case, only BRCMF_E_ACTION_FRAME_COMPLETE event will be received when
the frame is transmitted, which make the driver always wait a full
timeout duration. This patch has the completion signal be triggered by
receiving the BRCMF_E_ACTION_FRAME_COMPLETE event for the on-channel
case.

This change fixes WFA p2p certification 5.1.19 failure.

Signed-off-by: Chung-Hsien Hsu &lt;stanley.hsu@cypress.com&gt;
Signed-off-by: Chi-Hsien Lin &lt;chi-hsien.lin@cypress.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>brcmfmac: reduce timeout for action frame scan</title>
<updated>2019-11-25T08:53:32+00:00</updated>
<author>
<name>Chung-Hsien Hsu</name>
<email>stanley.hsu@cypress.com</email>
</author>
<published>2018-09-27T14:59:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=b2143dc589d24d61ec135eb4f7a2a0d673f28d52'/>
<id>b2143dc589d24d61ec135eb4f7a2a0d673f28d52</id>
<content type='text'>
[ Upstream commit edb6d6885bef82d1eac432dbeca9fbf4ec349d7e ]

Finding a common channel to send an action frame out is required for
some action types. Since a loop with several scan retry is used to find
the channel, a short wait time could be considered for each attempt.
This patch reduces the wait time from 1500 to 450 msec for each action
frame scan.

This patch fixes the WFA p2p certification 5.1.20 failure caused by the
long action frame send time.

Signed-off-by: Chung-Hsien Hsu &lt;stanley.hsu@cypress.com&gt;
Signed-off-by: Chi-Hsien Lin &lt;chi-hsien.lin@cypress.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit edb6d6885bef82d1eac432dbeca9fbf4ec349d7e ]

Finding a common channel to send an action frame out is required for
some action types. Since a loop with several scan retry is used to find
the channel, a short wait time could be considered for each attempt.
This patch reduces the wait time from 1500 to 450 msec for each action
frame scan.

This patch fixes the WFA p2p certification 5.1.20 failure caused by the
long action frame send time.

Signed-off-by: Chung-Hsien Hsu &lt;stanley.hsu@cypress.com&gt;
Signed-off-by: Chi-Hsien Lin &lt;chi-hsien.lin@cypress.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>brcmfmac: add subtype check for event handling in data path</title>
<updated>2019-06-11T10:22:44+00:00</updated>
<author>
<name>Arend van Spriel</name>
<email>arend.vanspriel@broadcom.com</email>
</author>
<published>2019-02-14T12:43:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=433b957a9e2df0305c1273011aa6e6cc0f8f815d'/>
<id>433b957a9e2df0305c1273011aa6e6cc0f8f815d</id>
<content type='text'>
commit a4176ec356c73a46c07c181c6d04039fafa34a9f upstream.

For USB there is no separate channel being used to pass events
from firmware to the host driver and as such are passed over the
data path. In order to detect mock event messages an additional
check is needed on event subtype. This check is added conditionally
using unlikely() keyword.

Reviewed-by: Hante Meuleman &lt;hante.meuleman@broadcom.com&gt;
Reviewed-by: Pieter-Paul Giesberts &lt;pieter-paul.giesberts@broadcom.com&gt;
Reviewed-by: Franky Lin &lt;franky.lin@broadcom.com&gt;
Signed-off-by: Arend van Spriel &lt;arend.vanspriel@broadcom.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Ben Hutchings &lt;ben.hutchings@codethink.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit a4176ec356c73a46c07c181c6d04039fafa34a9f upstream.

For USB there is no separate channel being used to pass events
from firmware to the host driver and as such are passed over the
data path. In order to detect mock event messages an additional
check is needed on event subtype. This check is added conditionally
using unlikely() keyword.

Reviewed-by: Hante Meuleman &lt;hante.meuleman@broadcom.com&gt;
Reviewed-by: Pieter-Paul Giesberts &lt;pieter-paul.giesberts@broadcom.com&gt;
Reviewed-by: Franky Lin &lt;franky.lin@broadcom.com&gt;
Signed-off-by: Arend van Spriel &lt;arend.vanspriel@broadcom.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Ben Hutchings &lt;ben.hutchings@codethink.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>brcmfmac: assure SSID length from firmware is limited</title>
<updated>2019-06-11T10:22:44+00:00</updated>
<author>
<name>Arend van Spriel</name>
<email>arend.vanspriel@broadcom.com</email>
</author>
<published>2019-02-14T12:43:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=76e7e98e229ae8fa7f4b30a6fd2bb3cd2ad26a67'/>
<id>76e7e98e229ae8fa7f4b30a6fd2bb3cd2ad26a67</id>
<content type='text'>
commit 1b5e2423164b3670e8bc9174e4762d297990deff upstream.

The SSID length as received from firmware should not exceed
IEEE80211_MAX_SSID_LEN as that would result in heap overflow.

Reviewed-by: Hante Meuleman &lt;hante.meuleman@broadcom.com&gt;
Reviewed-by: Pieter-Paul Giesberts &lt;pieter-paul.giesberts@broadcom.com&gt;
Reviewed-by: Franky Lin &lt;franky.lin@broadcom.com&gt;
Signed-off-by: Arend van Spriel &lt;arend.vanspriel@broadcom.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
[bwh: Backported to 4.9: adjust context]
Signed-off-by: Ben Hutchings &lt;ben.hutchings@codethink.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 1b5e2423164b3670e8bc9174e4762d297990deff upstream.

The SSID length as received from firmware should not exceed
IEEE80211_MAX_SSID_LEN as that would result in heap overflow.

Reviewed-by: Hante Meuleman &lt;hante.meuleman@broadcom.com&gt;
Reviewed-by: Pieter-Paul Giesberts &lt;pieter-paul.giesberts@broadcom.com&gt;
Reviewed-by: Franky Lin &lt;franky.lin@broadcom.com&gt;
Signed-off-by: Arend van Spriel &lt;arend.vanspriel@broadcom.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
[bwh: Backported to 4.9: adjust context]
Signed-off-by: Ben Hutchings &lt;ben.hutchings@codethink.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>brcmfmac: add length checks in scheduled scan result handler</title>
<updated>2019-06-11T10:22:44+00:00</updated>
<author>
<name>Arend Van Spriel</name>
<email>arend.vanspriel@broadcom.com</email>
</author>
<published>2017-04-06T12:14:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=0c7d97d45d62fb638b93ba1f00bd75611125f2a5'/>
<id>0c7d97d45d62fb638b93ba1f00bd75611125f2a5</id>
<content type='text'>
commit 4835f37e3bafc138f8bfa3cbed2920dd56fed283 upstream.

Assure the event data buffer is long enough to hold the array
of netinfo items and that SSID length does not exceed the maximum
of 32 characters as per 802.11 spec.

Reviewed-by: Hante Meuleman &lt;hante.meuleman@broadcom.com&gt;
Reviewed-by: Pieter-Paul Giesberts &lt;pieter-paul.giesberts@broadcom.com&gt;
Reviewed-by: Franky Lin &lt;franky.lin@broadcom.com&gt;
Signed-off-by: Arend van Spriel &lt;arend.vanspriel@broadcom.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
[bwh: Backported to 4.9:
 - Move the assignment to "data" along with the assignment to "netinfo_start"
   that depends on it
 - Adjust context, indentation]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 4835f37e3bafc138f8bfa3cbed2920dd56fed283 upstream.

Assure the event data buffer is long enough to hold the array
of netinfo items and that SSID length does not exceed the maximum
of 32 characters as per 802.11 spec.

Reviewed-by: Hante Meuleman &lt;hante.meuleman@broadcom.com&gt;
Reviewed-by: Pieter-Paul Giesberts &lt;pieter-paul.giesberts@broadcom.com&gt;
Reviewed-by: Franky Lin &lt;franky.lin@broadcom.com&gt;
Signed-off-by: Arend van Spriel &lt;arend.vanspriel@broadcom.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
[bwh: Backported to 4.9:
 - Move the assignment to "data" along with the assignment to "netinfo_start"
   that depends on it
 - Adjust context, indentation]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>brcmfmac: fix Oops when bringing up interface during USB disconnect</title>
<updated>2019-05-31T13:48:28+00:00</updated>
<author>
<name>Piotr Figiel</name>
<email>p.figiel@camlintechnologies.com</email>
</author>
<published>2019-03-13T09:52:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=638b996ec156c241491933ce424d7ed7b5f0a99e'/>
<id>638b996ec156c241491933ce424d7ed7b5f0a99e</id>
<content type='text'>
[ Upstream commit 24d413a31afaee9bbbf79226052c386b01780ce2 ]

Fix a race which leads to an Oops with NULL pointer dereference.  The
dereference is in brcmf_config_dongle() when cfg_to_ndev() attempts to get
net_device structure of interface with index 0 via if2bss mapping. This
shouldn't fail because of check for bus being ready in brcmf_netdev_open(),
but it's not synchronised with USB disconnect and there is a race: after
the check the bus can be marked down and the mapping for interface 0 may be
gone.

Solve this by modifying disconnect handling so that the removal of mapping
of ifidx to brcmf_if structure happens after netdev removal (which is
synchronous with brcmf_netdev_open() thanks to rtln being locked in
devinet_ioctl()). This assures brcmf_netdev_open() returns before the
mapping is removed during disconnect.

Unable to handle kernel NULL pointer dereference at virtual address 00000008
pgd = bcae2612
[00000008] *pgd=8be73831
Internal error: Oops: 17 [#1] PREEMPT SMP ARM
Modules linked in: brcmfmac brcmutil nf_log_ipv4 nf_log_common xt_LOG xt_limit
iptable_mangle xt_connmark xt_tcpudp xt_conntrack nf_conntrack nf_defrag_ipv6
nf_defrag_ipv4 iptable_filter ip_tables x_tables usb_f_mass_storage usb_f_rndis
u_ether usb_serial_simple usbserial cdc_acm smsc95xx usbnet ci_hdrc_imx ci_hdrc
usbmisc_imx ulpi 8250_exar 8250_pci 8250 8250_base libcomposite configfs
udc_core [last unloaded: brcmutil]
CPU: 2 PID: 24478 Comm: ifconfig Not tainted 4.19.23-00078-ga62866d-dirty #115
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
PC is at brcmf_cfg80211_up+0x94/0x29c [brcmfmac]
LR is at brcmf_cfg80211_up+0x8c/0x29c [brcmfmac]
pc : [&lt;7f26a91c&gt;]    lr : [&lt;7f26a914&gt;]    psr: a0070013
sp : eca99d28  ip : 00000000  fp : ee9c6c00
r10: 00000036  r9 : 00000000  r8 : ece4002c
r7 : edb5b800  r6 : 00000000  r5 : 80f08448  r4 : edb5b968
r3 : ffffffff  r2 : 00000000  r1 : 00000002  r0 : 00000000
Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c5387d  Table: 7ca0c04a  DAC: 00000051
Process ifconfig (pid: 24478, stack limit = 0xd9e85a0e)
Stack: (0xeca99d28 to 0xeca9a000)
9d20:                   00000000 80f873b0 0000000d 80f08448 eca99d68 50d45f32
9d40: 7f27de94 ece40000 80f08448 80f08448 7f27de94 ece4002c 00000000 00000036
9d60: ee9c6c00 7f27262c 00001002 50d45f32 ece40000 00000000 80f08448 80772008
9d80: 00000001 00001043 00001002 ece40000 00000000 50d45f32 ece40000 00000001
9da0: 80f08448 00001043 00001002 807723d0 00000000 50d45f32 80f08448 eca99e58
9dc0: 80f87113 50d45f32 80f08448 ece40000 ece40138 00001002 80f08448 00000000
9de0: 00000000 80772434 edbd5380 eca99e58 edbd5380 80f08448 ee9c6c0c 80805f70
9e00: 00000000 ede08e00 00008914 ece40000 00000014 ee9c6c0c 600c0013 00001043
9e20: 0208a8c0 ffffffff 00000000 50d45f32 eca98000 80f08448 7ee9fc38 00008914
9e40: 80f68e40 00000051 eca98000 00000036 00000003 80808b9c 6e616c77 00000030
9e60: 00000000 00000000 00001043 0208a8c0 ffffffff 00000000 80f08448 00000000
9e80: 00000000 816d8b20 600c0013 00000001 ede09320 801763d4 00000000 50d45f32
9ea0: eca98000 80f08448 7ee9fc38 50d45f32 00008914 80f08448 7ee9fc38 80f68e40
9ec0: ed531540 8074721c 00000800 00000001 00000000 6e616c77 00000030 00000000
9ee0: 00000000 00001002 0208a8c0 ffffffff 00000000 50d45f32 80f08448 7ee9fc38
9f00: ed531560 ec8fc900 80285a6c 80285138 edb910c0 00000000 ecd91008 ede08e00
9f20: 80f08448 00000000 00000000 816d8b20 600c0013 00000001 ede09320 801763d4
9f40: 00000000 50d45f32 00021000 edb91118 edb910c0 80f08448 01b29000 edb91118
9f60: eca99f7c 50d45f32 00021000 ec8fc900 00000003 ec8fc900 00008914 7ee9fc38
9f80: eca98000 00000036 00000003 80285a6c 00086364 7ee9fe1c 000000c3 00000036
9fa0: 801011c4 80101000 00086364 7ee9fe1c 00000003 00008914 7ee9fc38 00086364
9fc0: 00086364 7ee9fe1c 000000c3 00000036 0008630c 7ee9fe1c 7ee9fc38 00000003
9fe0: 000a42b8 7ee9fbd4 00019914 76e09acc 600c0010 00000003 00000000 00000000
[&lt;7f26a91c&gt;] (brcmf_cfg80211_up [brcmfmac]) from [&lt;7f27262c&gt;] (brcmf_netdev_open+0x74/0xe8 [brcmfmac])
[&lt;7f27262c&gt;] (brcmf_netdev_open [brcmfmac]) from [&lt;80772008&gt;] (__dev_open+0xcc/0x150)
[&lt;80772008&gt;] (__dev_open) from [&lt;807723d0&gt;] (__dev_change_flags+0x168/0x1b4)
[&lt;807723d0&gt;] (__dev_change_flags) from [&lt;80772434&gt;] (dev_change_flags+0x18/0x48)
[&lt;80772434&gt;] (dev_change_flags) from [&lt;80805f70&gt;] (devinet_ioctl+0x67c/0x79c)
[&lt;80805f70&gt;] (devinet_ioctl) from [&lt;80808b9c&gt;] (inet_ioctl+0x210/0x3d4)
[&lt;80808b9c&gt;] (inet_ioctl) from [&lt;8074721c&gt;] (sock_ioctl+0x350/0x524)
[&lt;8074721c&gt;] (sock_ioctl) from [&lt;80285138&gt;] (do_vfs_ioctl+0xb0/0x9b0)
[&lt;80285138&gt;] (do_vfs_ioctl) from [&lt;80285a6c&gt;] (ksys_ioctl+0x34/0x5c)
[&lt;80285a6c&gt;] (ksys_ioctl) from [&lt;80101000&gt;] (ret_fast_syscall+0x0/0x28)
Exception stack(0xeca99fa8 to 0xeca99ff0)
9fa0:                   00086364 7ee9fe1c 00000003 00008914 7ee9fc38 00086364
9fc0: 00086364 7ee9fe1c 000000c3 00000036 0008630c 7ee9fe1c 7ee9fc38 00000003
9fe0: 000a42b8 7ee9fbd4 00019914 76e09acc
Code: e5970328 eb002021 e1a02006 e3a01002 (e5909008)
---[ end trace 5cbac2333f3ac5df ]---

Signed-off-by: Piotr Figiel &lt;p.figiel@camlintechnologies.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 24d413a31afaee9bbbf79226052c386b01780ce2 ]

Fix a race which leads to an Oops with NULL pointer dereference.  The
dereference is in brcmf_config_dongle() when cfg_to_ndev() attempts to get
net_device structure of interface with index 0 via if2bss mapping. This
shouldn't fail because of check for bus being ready in brcmf_netdev_open(),
but it's not synchronised with USB disconnect and there is a race: after
the check the bus can be marked down and the mapping for interface 0 may be
gone.

Solve this by modifying disconnect handling so that the removal of mapping
of ifidx to brcmf_if structure happens after netdev removal (which is
synchronous with brcmf_netdev_open() thanks to rtln being locked in
devinet_ioctl()). This assures brcmf_netdev_open() returns before the
mapping is removed during disconnect.

Unable to handle kernel NULL pointer dereference at virtual address 00000008
pgd = bcae2612
[00000008] *pgd=8be73831
Internal error: Oops: 17 [#1] PREEMPT SMP ARM
Modules linked in: brcmfmac brcmutil nf_log_ipv4 nf_log_common xt_LOG xt_limit
iptable_mangle xt_connmark xt_tcpudp xt_conntrack nf_conntrack nf_defrag_ipv6
nf_defrag_ipv4 iptable_filter ip_tables x_tables usb_f_mass_storage usb_f_rndis
u_ether usb_serial_simple usbserial cdc_acm smsc95xx usbnet ci_hdrc_imx ci_hdrc
usbmisc_imx ulpi 8250_exar 8250_pci 8250 8250_base libcomposite configfs
udc_core [last unloaded: brcmutil]
CPU: 2 PID: 24478 Comm: ifconfig Not tainted 4.19.23-00078-ga62866d-dirty #115
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
PC is at brcmf_cfg80211_up+0x94/0x29c [brcmfmac]
LR is at brcmf_cfg80211_up+0x8c/0x29c [brcmfmac]
pc : [&lt;7f26a91c&gt;]    lr : [&lt;7f26a914&gt;]    psr: a0070013
sp : eca99d28  ip : 00000000  fp : ee9c6c00
r10: 00000036  r9 : 00000000  r8 : ece4002c
r7 : edb5b800  r6 : 00000000  r5 : 80f08448  r4 : edb5b968
r3 : ffffffff  r2 : 00000000  r1 : 00000002  r0 : 00000000
Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c5387d  Table: 7ca0c04a  DAC: 00000051
Process ifconfig (pid: 24478, stack limit = 0xd9e85a0e)
Stack: (0xeca99d28 to 0xeca9a000)
9d20:                   00000000 80f873b0 0000000d 80f08448 eca99d68 50d45f32
9d40: 7f27de94 ece40000 80f08448 80f08448 7f27de94 ece4002c 00000000 00000036
9d60: ee9c6c00 7f27262c 00001002 50d45f32 ece40000 00000000 80f08448 80772008
9d80: 00000001 00001043 00001002 ece40000 00000000 50d45f32 ece40000 00000001
9da0: 80f08448 00001043 00001002 807723d0 00000000 50d45f32 80f08448 eca99e58
9dc0: 80f87113 50d45f32 80f08448 ece40000 ece40138 00001002 80f08448 00000000
9de0: 00000000 80772434 edbd5380 eca99e58 edbd5380 80f08448 ee9c6c0c 80805f70
9e00: 00000000 ede08e00 00008914 ece40000 00000014 ee9c6c0c 600c0013 00001043
9e20: 0208a8c0 ffffffff 00000000 50d45f32 eca98000 80f08448 7ee9fc38 00008914
9e40: 80f68e40 00000051 eca98000 00000036 00000003 80808b9c 6e616c77 00000030
9e60: 00000000 00000000 00001043 0208a8c0 ffffffff 00000000 80f08448 00000000
9e80: 00000000 816d8b20 600c0013 00000001 ede09320 801763d4 00000000 50d45f32
9ea0: eca98000 80f08448 7ee9fc38 50d45f32 00008914 80f08448 7ee9fc38 80f68e40
9ec0: ed531540 8074721c 00000800 00000001 00000000 6e616c77 00000030 00000000
9ee0: 00000000 00001002 0208a8c0 ffffffff 00000000 50d45f32 80f08448 7ee9fc38
9f00: ed531560 ec8fc900 80285a6c 80285138 edb910c0 00000000 ecd91008 ede08e00
9f20: 80f08448 00000000 00000000 816d8b20 600c0013 00000001 ede09320 801763d4
9f40: 00000000 50d45f32 00021000 edb91118 edb910c0 80f08448 01b29000 edb91118
9f60: eca99f7c 50d45f32 00021000 ec8fc900 00000003 ec8fc900 00008914 7ee9fc38
9f80: eca98000 00000036 00000003 80285a6c 00086364 7ee9fe1c 000000c3 00000036
9fa0: 801011c4 80101000 00086364 7ee9fe1c 00000003 00008914 7ee9fc38 00086364
9fc0: 00086364 7ee9fe1c 000000c3 00000036 0008630c 7ee9fe1c 7ee9fc38 00000003
9fe0: 000a42b8 7ee9fbd4 00019914 76e09acc 600c0010 00000003 00000000 00000000
[&lt;7f26a91c&gt;] (brcmf_cfg80211_up [brcmfmac]) from [&lt;7f27262c&gt;] (brcmf_netdev_open+0x74/0xe8 [brcmfmac])
[&lt;7f27262c&gt;] (brcmf_netdev_open [brcmfmac]) from [&lt;80772008&gt;] (__dev_open+0xcc/0x150)
[&lt;80772008&gt;] (__dev_open) from [&lt;807723d0&gt;] (__dev_change_flags+0x168/0x1b4)
[&lt;807723d0&gt;] (__dev_change_flags) from [&lt;80772434&gt;] (dev_change_flags+0x18/0x48)
[&lt;80772434&gt;] (dev_change_flags) from [&lt;80805f70&gt;] (devinet_ioctl+0x67c/0x79c)
[&lt;80805f70&gt;] (devinet_ioctl) from [&lt;80808b9c&gt;] (inet_ioctl+0x210/0x3d4)
[&lt;80808b9c&gt;] (inet_ioctl) from [&lt;8074721c&gt;] (sock_ioctl+0x350/0x524)
[&lt;8074721c&gt;] (sock_ioctl) from [&lt;80285138&gt;] (do_vfs_ioctl+0xb0/0x9b0)
[&lt;80285138&gt;] (do_vfs_ioctl) from [&lt;80285a6c&gt;] (ksys_ioctl+0x34/0x5c)
[&lt;80285a6c&gt;] (ksys_ioctl) from [&lt;80101000&gt;] (ret_fast_syscall+0x0/0x28)
Exception stack(0xeca99fa8 to 0xeca99ff0)
9fa0:                   00086364 7ee9fe1c 00000003 00008914 7ee9fc38 00086364
9fc0: 00086364 7ee9fe1c 000000c3 00000036 0008630c 7ee9fe1c 7ee9fc38 00000003
9fe0: 000a42b8 7ee9fbd4 00019914 76e09acc
Code: e5970328 eb002021 e1a02006 e3a01002 (e5909008)
---[ end trace 5cbac2333f3ac5df ]---

Signed-off-by: Piotr Figiel &lt;p.figiel@camlintechnologies.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>brcmfmac: fix race during disconnect when USB completion is in progress</title>
<updated>2019-05-31T13:48:28+00:00</updated>
<author>
<name>Piotr Figiel</name>
<email>p.figiel@camlintechnologies.com</email>
</author>
<published>2019-03-08T15:25:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d857a7a203654d65e2d8f0a69191df432f10ddde'/>
<id>d857a7a203654d65e2d8f0a69191df432f10ddde</id>
<content type='text'>
[ Upstream commit db3b9e2e1d58080d0754bdf9293dabf8c6491b67 ]

It was observed that rarely during USB disconnect happening shortly after
connect (before full initialization completes) usb_hub_wq would wait
forever for the dev_init_lock to be unlocked. dev_init_lock would remain
locked though because of infinite wait during usb_kill_urb:

[ 2730.656472] kworker/0:2     D    0   260      2 0x00000000
[ 2730.660700] Workqueue: events request_firmware_work_func
[ 2730.664807] [&lt;809dca20&gt;] (__schedule) from [&lt;809dd164&gt;] (schedule+0x4c/0xac)
[ 2730.670587] [&lt;809dd164&gt;] (schedule) from [&lt;8069af44&gt;] (usb_kill_urb+0xdc/0x114)
[ 2730.676815] [&lt;8069af44&gt;] (usb_kill_urb) from [&lt;7f258b50&gt;] (brcmf_usb_free_q+0x34/0xa8 [brcmfmac])
[ 2730.684833] [&lt;7f258b50&gt;] (brcmf_usb_free_q [brcmfmac]) from [&lt;7f2517d4&gt;] (brcmf_detach+0xa0/0xb8 [brcmfmac])
[ 2730.693557] [&lt;7f2517d4&gt;] (brcmf_detach [brcmfmac]) from [&lt;7f251a34&gt;] (brcmf_attach+0xac/0x3d8 [brcmfmac])
[ 2730.702094] [&lt;7f251a34&gt;] (brcmf_attach [brcmfmac]) from [&lt;7f2587ac&gt;] (brcmf_usb_probe_phase2+0x468/0x4a0 [brcmfmac])
[ 2730.711601] [&lt;7f2587ac&gt;] (brcmf_usb_probe_phase2 [brcmfmac]) from [&lt;7f252888&gt;] (brcmf_fw_request_done+0x194/0x220 [brcmfmac])
[ 2730.721795] [&lt;7f252888&gt;] (brcmf_fw_request_done [brcmfmac]) from [&lt;805748e4&gt;] (request_firmware_work_func+0x4c/0x88)
[ 2730.731125] [&lt;805748e4&gt;] (request_firmware_work_func) from [&lt;80141474&gt;] (process_one_work+0x228/0x808)
[ 2730.739223] [&lt;80141474&gt;] (process_one_work) from [&lt;80141a80&gt;] (worker_thread+0x2c/0x564)
[ 2730.746105] [&lt;80141a80&gt;] (worker_thread) from [&lt;80147bcc&gt;] (kthread+0x13c/0x16c)
[ 2730.752227] [&lt;80147bcc&gt;] (kthread) from [&lt;801010b4&gt;] (ret_from_fork+0x14/0x20)

[ 2733.099695] kworker/0:3     D    0  1065      2 0x00000000
[ 2733.103926] Workqueue: usb_hub_wq hub_event
[ 2733.106914] [&lt;809dca20&gt;] (__schedule) from [&lt;809dd164&gt;] (schedule+0x4c/0xac)
[ 2733.112693] [&lt;809dd164&gt;] (schedule) from [&lt;809e2a8c&gt;] (schedule_timeout+0x214/0x3e4)
[ 2733.119621] [&lt;809e2a8c&gt;] (schedule_timeout) from [&lt;809dde2c&gt;] (wait_for_common+0xc4/0x1c0)
[ 2733.126810] [&lt;809dde2c&gt;] (wait_for_common) from [&lt;7f258d00&gt;] (brcmf_usb_disconnect+0x1c/0x4c [brcmfmac])
[ 2733.135206] [&lt;7f258d00&gt;] (brcmf_usb_disconnect [brcmfmac]) from [&lt;8069e0c8&gt;] (usb_unbind_interface+0x5c/0x1e4)
[ 2733.143943] [&lt;8069e0c8&gt;] (usb_unbind_interface) from [&lt;8056d3e8&gt;] (device_release_driver_internal+0x164/0x1fc)
[ 2733.152769] [&lt;8056d3e8&gt;] (device_release_driver_internal) from [&lt;8056c078&gt;] (bus_remove_device+0xd0/0xfc)
[ 2733.161138] [&lt;8056c078&gt;] (bus_remove_device) from [&lt;8056977c&gt;] (device_del+0x11c/0x310)
[ 2733.167939] [&lt;8056977c&gt;] (device_del) from [&lt;8069cba8&gt;] (usb_disable_device+0xa0/0x1cc)
[ 2733.174743] [&lt;8069cba8&gt;] (usb_disable_device) from [&lt;8069507c&gt;] (usb_disconnect+0x74/0x1dc)
[ 2733.181823] [&lt;8069507c&gt;] (usb_disconnect) from [&lt;80695e88&gt;] (hub_event+0x478/0xf88)
[ 2733.188278] [&lt;80695e88&gt;] (hub_event) from [&lt;80141474&gt;] (process_one_work+0x228/0x808)
[ 2733.194905] [&lt;80141474&gt;] (process_one_work) from [&lt;80141a80&gt;] (worker_thread+0x2c/0x564)
[ 2733.201724] [&lt;80141a80&gt;] (worker_thread) from [&lt;80147bcc&gt;] (kthread+0x13c/0x16c)
[ 2733.207913] [&lt;80147bcc&gt;] (kthread) from [&lt;801010b4&gt;] (ret_from_fork+0x14/0x20)

It was traced down to a case where usb_kill_urb would be called on an URB
structure containing more or less random data, including large number in
its use_count. During the debugging it appeared that in brcmf_usb_free_q()
the traversal over URBs' lists is not synchronized with operations on those
lists in brcmf_usb_rx_complete() leading to handling
brcmf_usbdev_info structure (holding lists' head) as lists' element and in
result causing above problem.

Fix it by walking through all URBs during brcmf_cancel_all_urbs using the
arrays of requests instead of linked lists.

Signed-off-by: Piotr Figiel &lt;p.figiel@camlintechnologies.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit db3b9e2e1d58080d0754bdf9293dabf8c6491b67 ]

It was observed that rarely during USB disconnect happening shortly after
connect (before full initialization completes) usb_hub_wq would wait
forever for the dev_init_lock to be unlocked. dev_init_lock would remain
locked though because of infinite wait during usb_kill_urb:

[ 2730.656472] kworker/0:2     D    0   260      2 0x00000000
[ 2730.660700] Workqueue: events request_firmware_work_func
[ 2730.664807] [&lt;809dca20&gt;] (__schedule) from [&lt;809dd164&gt;] (schedule+0x4c/0xac)
[ 2730.670587] [&lt;809dd164&gt;] (schedule) from [&lt;8069af44&gt;] (usb_kill_urb+0xdc/0x114)
[ 2730.676815] [&lt;8069af44&gt;] (usb_kill_urb) from [&lt;7f258b50&gt;] (brcmf_usb_free_q+0x34/0xa8 [brcmfmac])
[ 2730.684833] [&lt;7f258b50&gt;] (brcmf_usb_free_q [brcmfmac]) from [&lt;7f2517d4&gt;] (brcmf_detach+0xa0/0xb8 [brcmfmac])
[ 2730.693557] [&lt;7f2517d4&gt;] (brcmf_detach [brcmfmac]) from [&lt;7f251a34&gt;] (brcmf_attach+0xac/0x3d8 [brcmfmac])
[ 2730.702094] [&lt;7f251a34&gt;] (brcmf_attach [brcmfmac]) from [&lt;7f2587ac&gt;] (brcmf_usb_probe_phase2+0x468/0x4a0 [brcmfmac])
[ 2730.711601] [&lt;7f2587ac&gt;] (brcmf_usb_probe_phase2 [brcmfmac]) from [&lt;7f252888&gt;] (brcmf_fw_request_done+0x194/0x220 [brcmfmac])
[ 2730.721795] [&lt;7f252888&gt;] (brcmf_fw_request_done [brcmfmac]) from [&lt;805748e4&gt;] (request_firmware_work_func+0x4c/0x88)
[ 2730.731125] [&lt;805748e4&gt;] (request_firmware_work_func) from [&lt;80141474&gt;] (process_one_work+0x228/0x808)
[ 2730.739223] [&lt;80141474&gt;] (process_one_work) from [&lt;80141a80&gt;] (worker_thread+0x2c/0x564)
[ 2730.746105] [&lt;80141a80&gt;] (worker_thread) from [&lt;80147bcc&gt;] (kthread+0x13c/0x16c)
[ 2730.752227] [&lt;80147bcc&gt;] (kthread) from [&lt;801010b4&gt;] (ret_from_fork+0x14/0x20)

[ 2733.099695] kworker/0:3     D    0  1065      2 0x00000000
[ 2733.103926] Workqueue: usb_hub_wq hub_event
[ 2733.106914] [&lt;809dca20&gt;] (__schedule) from [&lt;809dd164&gt;] (schedule+0x4c/0xac)
[ 2733.112693] [&lt;809dd164&gt;] (schedule) from [&lt;809e2a8c&gt;] (schedule_timeout+0x214/0x3e4)
[ 2733.119621] [&lt;809e2a8c&gt;] (schedule_timeout) from [&lt;809dde2c&gt;] (wait_for_common+0xc4/0x1c0)
[ 2733.126810] [&lt;809dde2c&gt;] (wait_for_common) from [&lt;7f258d00&gt;] (brcmf_usb_disconnect+0x1c/0x4c [brcmfmac])
[ 2733.135206] [&lt;7f258d00&gt;] (brcmf_usb_disconnect [brcmfmac]) from [&lt;8069e0c8&gt;] (usb_unbind_interface+0x5c/0x1e4)
[ 2733.143943] [&lt;8069e0c8&gt;] (usb_unbind_interface) from [&lt;8056d3e8&gt;] (device_release_driver_internal+0x164/0x1fc)
[ 2733.152769] [&lt;8056d3e8&gt;] (device_release_driver_internal) from [&lt;8056c078&gt;] (bus_remove_device+0xd0/0xfc)
[ 2733.161138] [&lt;8056c078&gt;] (bus_remove_device) from [&lt;8056977c&gt;] (device_del+0x11c/0x310)
[ 2733.167939] [&lt;8056977c&gt;] (device_del) from [&lt;8069cba8&gt;] (usb_disable_device+0xa0/0x1cc)
[ 2733.174743] [&lt;8069cba8&gt;] (usb_disable_device) from [&lt;8069507c&gt;] (usb_disconnect+0x74/0x1dc)
[ 2733.181823] [&lt;8069507c&gt;] (usb_disconnect) from [&lt;80695e88&gt;] (hub_event+0x478/0xf88)
[ 2733.188278] [&lt;80695e88&gt;] (hub_event) from [&lt;80141474&gt;] (process_one_work+0x228/0x808)
[ 2733.194905] [&lt;80141474&gt;] (process_one_work) from [&lt;80141a80&gt;] (worker_thread+0x2c/0x564)
[ 2733.201724] [&lt;80141a80&gt;] (worker_thread) from [&lt;80147bcc&gt;] (kthread+0x13c/0x16c)
[ 2733.207913] [&lt;80147bcc&gt;] (kthread) from [&lt;801010b4&gt;] (ret_from_fork+0x14/0x20)

It was traced down to a case where usb_kill_urb would be called on an URB
structure containing more or less random data, including large number in
its use_count. During the debugging it appeared that in brcmf_usb_free_q()
the traversal over URBs' lists is not synchronized with operations on those
lists in brcmf_usb_rx_complete() leading to handling
brcmf_usbdev_info structure (holding lists' head) as lists' element and in
result causing above problem.

Fix it by walking through all URBs during brcmf_cancel_all_urbs using the
arrays of requests instead of linked lists.

Signed-off-by: Piotr Figiel &lt;p.figiel@camlintechnologies.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>brcmfmac: convert dev_init_lock mutex to completion</title>
<updated>2019-05-31T13:48:28+00:00</updated>
<author>
<name>Piotr Figiel</name>
<email>p.figiel@camlintechnologies.com</email>
</author>
<published>2019-03-13T09:52:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d696d385993c83ffa5debbf5200de8303a036cb6'/>
<id>d696d385993c83ffa5debbf5200de8303a036cb6</id>
<content type='text'>
[ Upstream commit a9fd0953fa4a62887306be28641b4b0809f3b2fd ]

Leaving dev_init_lock mutex locked in probe causes BUG and a WARNING when
kernel is compiled with CONFIG_PROVE_LOCKING. Convert mutex to completion
which silences those warnings and improves code readability.

Fix below errors when connecting the USB WiFi dongle:

brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43143 for chip BCM43143/2
BUG: workqueue leaked lock or atomic: kworker/0:2/0x00000000/434
     last function: hub_event
1 lock held by kworker/0:2/434:
 #0: 18d5dcdf (&amp;devinfo-&gt;dev_init_lock){+.+.}, at: brcmf_usb_probe+0x78/0x550 [brcmfmac]
CPU: 0 PID: 434 Comm: kworker/0:2 Not tainted 4.19.23-00084-g454a789-dirty #123
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
Workqueue: usb_hub_wq hub_event
[&lt;8011237c&gt;] (unwind_backtrace) from [&lt;8010d74c&gt;] (show_stack+0x10/0x14)
[&lt;8010d74c&gt;] (show_stack) from [&lt;809c4324&gt;] (dump_stack+0xa8/0xd4)
[&lt;809c4324&gt;] (dump_stack) from [&lt;8014195c&gt;] (process_one_work+0x710/0x808)
[&lt;8014195c&gt;] (process_one_work) from [&lt;80141a80&gt;] (worker_thread+0x2c/0x564)
[&lt;80141a80&gt;] (worker_thread) from [&lt;80147bcc&gt;] (kthread+0x13c/0x16c)
[&lt;80147bcc&gt;] (kthread) from [&lt;801010b4&gt;] (ret_from_fork+0x14/0x20)
Exception stack(0xed1d9fb0 to 0xed1d9ff8)
9fa0:                                     00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000

======================================================
WARNING: possible circular locking dependency detected
4.19.23-00084-g454a789-dirty #123 Not tainted
------------------------------------------------------
kworker/0:2/434 is trying to acquire lock:
e29cf799 ((wq_completion)"events"){+.+.}, at: process_one_work+0x174/0x808

but task is already holding lock:
18d5dcdf (&amp;devinfo-&gt;dev_init_lock){+.+.}, at: brcmf_usb_probe+0x78/0x550 [brcmfmac]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-&gt; #2 (&amp;devinfo-&gt;dev_init_lock){+.+.}:
       mutex_lock_nested+0x1c/0x24
       brcmf_usb_probe+0x78/0x550 [brcmfmac]
       usb_probe_interface+0xc0/0x1bc
       really_probe+0x228/0x2c0
       __driver_attach+0xe4/0xe8
       bus_for_each_dev+0x68/0xb4
       bus_add_driver+0x19c/0x214
       driver_register+0x78/0x110
       usb_register_driver+0x84/0x148
       process_one_work+0x228/0x808
       worker_thread+0x2c/0x564
       kthread+0x13c/0x16c
       ret_from_fork+0x14/0x20
         (null)

-&gt; #1 (brcmf_driver_work){+.+.}:
       worker_thread+0x2c/0x564
       kthread+0x13c/0x16c
       ret_from_fork+0x14/0x20
         (null)

-&gt; #0 ((wq_completion)"events"){+.+.}:
       process_one_work+0x1b8/0x808
       worker_thread+0x2c/0x564
       kthread+0x13c/0x16c
       ret_from_fork+0x14/0x20
         (null)

other info that might help us debug this:

Chain exists of:
  (wq_completion)"events" --&gt; brcmf_driver_work --&gt; &amp;devinfo-&gt;dev_init_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&amp;devinfo-&gt;dev_init_lock);
                               lock(brcmf_driver_work);
                               lock(&amp;devinfo-&gt;dev_init_lock);
  lock((wq_completion)"events");

 *** DEADLOCK ***

1 lock held by kworker/0:2/434:
 #0: 18d5dcdf (&amp;devinfo-&gt;dev_init_lock){+.+.}, at: brcmf_usb_probe+0x78/0x550 [brcmfmac]

stack backtrace:
CPU: 0 PID: 434 Comm: kworker/0:2 Not tainted 4.19.23-00084-g454a789-dirty #123
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
Workqueue: events request_firmware_work_func
[&lt;8011237c&gt;] (unwind_backtrace) from [&lt;8010d74c&gt;] (show_stack+0x10/0x14)
[&lt;8010d74c&gt;] (show_stack) from [&lt;809c4324&gt;] (dump_stack+0xa8/0xd4)
[&lt;809c4324&gt;] (dump_stack) from [&lt;80172838&gt;] (print_circular_bug+0x210/0x330)
[&lt;80172838&gt;] (print_circular_bug) from [&lt;80175940&gt;] (__lock_acquire+0x160c/0x1a30)
[&lt;80175940&gt;] (__lock_acquire) from [&lt;8017671c&gt;] (lock_acquire+0xe0/0x268)
[&lt;8017671c&gt;] (lock_acquire) from [&lt;80141404&gt;] (process_one_work+0x1b8/0x808)
[&lt;80141404&gt;] (process_one_work) from [&lt;80141a80&gt;] (worker_thread+0x2c/0x564)
[&lt;80141a80&gt;] (worker_thread) from [&lt;80147bcc&gt;] (kthread+0x13c/0x16c)
[&lt;80147bcc&gt;] (kthread) from [&lt;801010b4&gt;] (ret_from_fork+0x14/0x20)
Exception stack(0xed1d9fb0 to 0xed1d9ff8)
9fa0:                                     00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000

Signed-off-by: Piotr Figiel &lt;p.figiel@camlintechnologies.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit a9fd0953fa4a62887306be28641b4b0809f3b2fd ]

Leaving dev_init_lock mutex locked in probe causes BUG and a WARNING when
kernel is compiled with CONFIG_PROVE_LOCKING. Convert mutex to completion
which silences those warnings and improves code readability.

Fix below errors when connecting the USB WiFi dongle:

brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43143 for chip BCM43143/2
BUG: workqueue leaked lock or atomic: kworker/0:2/0x00000000/434
     last function: hub_event
1 lock held by kworker/0:2/434:
 #0: 18d5dcdf (&amp;devinfo-&gt;dev_init_lock){+.+.}, at: brcmf_usb_probe+0x78/0x550 [brcmfmac]
CPU: 0 PID: 434 Comm: kworker/0:2 Not tainted 4.19.23-00084-g454a789-dirty #123
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
Workqueue: usb_hub_wq hub_event
[&lt;8011237c&gt;] (unwind_backtrace) from [&lt;8010d74c&gt;] (show_stack+0x10/0x14)
[&lt;8010d74c&gt;] (show_stack) from [&lt;809c4324&gt;] (dump_stack+0xa8/0xd4)
[&lt;809c4324&gt;] (dump_stack) from [&lt;8014195c&gt;] (process_one_work+0x710/0x808)
[&lt;8014195c&gt;] (process_one_work) from [&lt;80141a80&gt;] (worker_thread+0x2c/0x564)
[&lt;80141a80&gt;] (worker_thread) from [&lt;80147bcc&gt;] (kthread+0x13c/0x16c)
[&lt;80147bcc&gt;] (kthread) from [&lt;801010b4&gt;] (ret_from_fork+0x14/0x20)
Exception stack(0xed1d9fb0 to 0xed1d9ff8)
9fa0:                                     00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000

======================================================
WARNING: possible circular locking dependency detected
4.19.23-00084-g454a789-dirty #123 Not tainted
------------------------------------------------------
kworker/0:2/434 is trying to acquire lock:
e29cf799 ((wq_completion)"events"){+.+.}, at: process_one_work+0x174/0x808

but task is already holding lock:
18d5dcdf (&amp;devinfo-&gt;dev_init_lock){+.+.}, at: brcmf_usb_probe+0x78/0x550 [brcmfmac]

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-&gt; #2 (&amp;devinfo-&gt;dev_init_lock){+.+.}:
       mutex_lock_nested+0x1c/0x24
       brcmf_usb_probe+0x78/0x550 [brcmfmac]
       usb_probe_interface+0xc0/0x1bc
       really_probe+0x228/0x2c0
       __driver_attach+0xe4/0xe8
       bus_for_each_dev+0x68/0xb4
       bus_add_driver+0x19c/0x214
       driver_register+0x78/0x110
       usb_register_driver+0x84/0x148
       process_one_work+0x228/0x808
       worker_thread+0x2c/0x564
       kthread+0x13c/0x16c
       ret_from_fork+0x14/0x20
         (null)

-&gt; #1 (brcmf_driver_work){+.+.}:
       worker_thread+0x2c/0x564
       kthread+0x13c/0x16c
       ret_from_fork+0x14/0x20
         (null)

-&gt; #0 ((wq_completion)"events"){+.+.}:
       process_one_work+0x1b8/0x808
       worker_thread+0x2c/0x564
       kthread+0x13c/0x16c
       ret_from_fork+0x14/0x20
         (null)

other info that might help us debug this:

Chain exists of:
  (wq_completion)"events" --&gt; brcmf_driver_work --&gt; &amp;devinfo-&gt;dev_init_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&amp;devinfo-&gt;dev_init_lock);
                               lock(brcmf_driver_work);
                               lock(&amp;devinfo-&gt;dev_init_lock);
  lock((wq_completion)"events");

 *** DEADLOCK ***

1 lock held by kworker/0:2/434:
 #0: 18d5dcdf (&amp;devinfo-&gt;dev_init_lock){+.+.}, at: brcmf_usb_probe+0x78/0x550 [brcmfmac]

stack backtrace:
CPU: 0 PID: 434 Comm: kworker/0:2 Not tainted 4.19.23-00084-g454a789-dirty #123
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
Workqueue: events request_firmware_work_func
[&lt;8011237c&gt;] (unwind_backtrace) from [&lt;8010d74c&gt;] (show_stack+0x10/0x14)
[&lt;8010d74c&gt;] (show_stack) from [&lt;809c4324&gt;] (dump_stack+0xa8/0xd4)
[&lt;809c4324&gt;] (dump_stack) from [&lt;80172838&gt;] (print_circular_bug+0x210/0x330)
[&lt;80172838&gt;] (print_circular_bug) from [&lt;80175940&gt;] (__lock_acquire+0x160c/0x1a30)
[&lt;80175940&gt;] (__lock_acquire) from [&lt;8017671c&gt;] (lock_acquire+0xe0/0x268)
[&lt;8017671c&gt;] (lock_acquire) from [&lt;80141404&gt;] (process_one_work+0x1b8/0x808)
[&lt;80141404&gt;] (process_one_work) from [&lt;80141a80&gt;] (worker_thread+0x2c/0x564)
[&lt;80141a80&gt;] (worker_thread) from [&lt;80147bcc&gt;] (kthread+0x13c/0x16c)
[&lt;80147bcc&gt;] (kthread) from [&lt;801010b4&gt;] (ret_from_fork+0x14/0x20)
Exception stack(0xed1d9fb0 to 0xed1d9ff8)
9fa0:                                     00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000

Signed-off-by: Piotr Figiel &lt;p.figiel@camlintechnologies.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
