<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/net/wireless, branch v4.4.185</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>brcmfmac: add subtype check for event handling in data path</title>
<updated>2019-06-11T10:24:11+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=4e06554db5e5c3d693141b84aba3a4f29b7d9ef5'/>
<id>4e06554db5e5c3d693141b84aba3a4f29b7d9ef5</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;
[bwh: Backported to 4.4: adjust filenames]
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;
[bwh: Backported to 4.4: adjust filenames]
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:24:11+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=993b68aa3ef775f800cbc580846e1ba7cc82411c'/>
<id>993b68aa3ef775f800cbc580846e1ba7cc82411c</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.4:
 - Move the assignment to "data" along with the assignment to "netinfo_start"
   that depends on it
 - Adjust filename, context, indentation]
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 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.4:
 - Move the assignment to "data" along with the assignment to "netinfo_start"
   that depends on it
 - Adjust filename, context, indentation]
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: fix incorrect event channel deduction</title>
<updated>2019-06-11T10:24:11+00:00</updated>
<author>
<name>Gavin Li</name>
<email>git@thegavinli.com</email>
</author>
<published>2017-01-17T23:24:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=35bcfbad5d946a50e2b29409e129ac673f7ce085'/>
<id>35bcfbad5d946a50e2b29409e129ac673f7ce085</id>
<content type='text'>
commit 8e290cecdd0178f3d4cf7d463c51dc7e462843b4 upstream.

brcmf_sdio_fromevntchan() was being called on the the data frame
rather than the software header, causing some frames to be
mischaracterized as on the event channel rather than the data channel.

This fixes a major performance regression (due to dropped packets). With
this patch the download speed jumped from 1Mbit/s back up to 40MBit/s due
to the sheer amount of packets being incorrectly processed.

Fixes: c56caa9db8ab ("brcmfmac: screening firmware event packet")
Signed-off-by: Gavin Li &lt;git@thegavinli.com&gt;
Acked-by: Arend van Spriel &lt;arend.vanspriel@broadcom.com&gt;
[kvalo@codeaurora.org: improve commit logs based on email discussion]
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
[bwh: Backported to 4.4: adjust filename]
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 8e290cecdd0178f3d4cf7d463c51dc7e462843b4 upstream.

brcmf_sdio_fromevntchan() was being called on the the data frame
rather than the software header, causing some frames to be
mischaracterized as on the event channel rather than the data channel.

This fixes a major performance regression (due to dropped packets). With
this patch the download speed jumped from 1Mbit/s back up to 40MBit/s due
to the sheer amount of packets being incorrectly processed.

Fixes: c56caa9db8ab ("brcmfmac: screening firmware event packet")
Signed-off-by: Gavin Li &lt;git@thegavinli.com&gt;
Acked-by: Arend van Spriel &lt;arend.vanspriel@broadcom.com&gt;
[kvalo@codeaurora.org: improve commit logs based on email discussion]
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
[bwh: Backported to 4.4: adjust filename]
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: revise handling events in receive path</title>
<updated>2019-06-11T10:24:11+00:00</updated>
<author>
<name>Arend van Spriel</name>
<email>arend@broadcom.com</email>
</author>
<published>2016-04-11T09:35:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=8c12de962667bdb53816f7b552dbfd9344981085'/>
<id>8c12de962667bdb53816f7b552dbfd9344981085</id>
<content type='text'>
commit 9c349892ccc90c6de2baaa69cc78449f58082273 upstream.

Move event handling out of brcmf_netif_rx() avoiding the need
to pass a flag. This flag is only ever true for USB hosts as
other interface use separate brcmf_rx_event() function.

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@broadcom.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
[bwh: Backported to 4.4 as dependency of commit a4176ec356c7
 "brcmfmac: add subtype check for event handling in data path"
 - Adjust filenames, 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 9c349892ccc90c6de2baaa69cc78449f58082273 upstream.

Move event handling out of brcmf_netif_rx() avoiding the need
to pass a flag. This flag is only ever true for USB hosts as
other interface use separate brcmf_rx_event() function.

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@broadcom.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
[bwh: Backported to 4.4 as dependency of commit a4176ec356c7
 "brcmfmac: add subtype check for event handling in data path"
 - Adjust filenames, 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: screening firmware event packet</title>
<updated>2019-06-11T10:24:11+00:00</updated>
<author>
<name>Franky Lin</name>
<email>franky.lin@broadcom.com</email>
</author>
<published>2016-04-11T09:35:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=5f4688a15c2481108f1bfb9e0e3b44214c1ea618'/>
<id>5f4688a15c2481108f1bfb9e0e3b44214c1ea618</id>
<content type='text'>
commit c56caa9db8abbbfb9e31325e0897705aa897db37 upstream.

Firmware uses asynchronized events as a communication method to the
host. The event packets are marked as ETH_P_LINK_CTL protocol type. For
SDIO and PCIe bus, this kind of packets are delivered through virtual
event channel not data channel. This patch adds a screening logic to
make sure the event handler only processes the events coming from the
correct channel.

Reviewed-by: Pieter-Paul Giesberts &lt;pieter-paul.giesberts@broadcom.com&gt;
Signed-off-by: Franky Lin &lt;franky.lin@broadcom.com&gt;
Signed-off-by: Arend van Spriel &lt;arend@broadcom.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
[bwh: Backported to 4.4 adjust filenames]
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 c56caa9db8abbbfb9e31325e0897705aa897db37 upstream.

Firmware uses asynchronized events as a communication method to the
host. The event packets are marked as ETH_P_LINK_CTL protocol type. For
SDIO and PCIe bus, this kind of packets are delivered through virtual
event channel not data channel. This patch adds a screening logic to
make sure the event handler only processes the events coming from the
correct channel.

Reviewed-by: Pieter-Paul Giesberts &lt;pieter-paul.giesberts@broadcom.com&gt;
Signed-off-by: Franky Lin &lt;franky.lin@broadcom.com&gt;
Signed-off-by: Arend van Spriel &lt;arend@broadcom.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
[bwh: Backported to 4.4 adjust filenames]
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 on firmware events</title>
<updated>2019-06-11T10:24:11+00:00</updated>
<author>
<name>Hante Meuleman</name>
<email>meuleman@broadcom.com</email>
</author>
<published>2016-02-17T10:26:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=6da841e9ae8736c87d684babdd0140c45e3d2a06'/>
<id>6da841e9ae8736c87d684babdd0140c45e3d2a06</id>
<content type='text'>
commit 0aedbcaf6f182690790d98d90d5fe1e64c846c34 upstream.

Add additional length checks on firmware events to create more
robust code.

Reviewed-by: Arend Van Spriel &lt;arend@broadcom.com&gt;
Reviewed-by: Franky (Zhenhui) Lin &lt;frankyl@broadcom.com&gt;
Reviewed-by: Pieter-Paul Giesberts &lt;pieterpg@broadcom.com&gt;
Reviewed-by: Lei Zhang &lt;leizh@broadcom.com&gt;
Signed-off-by: Hante Meuleman &lt;meuleman@broadcom.com&gt;
Signed-off-by: Arend van Spriel &lt;arend@broadcom.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
[bwh: Backported to 4.4:
 - Drop changes to brcmf_wowl_nd_results()
 - Adjust filenames]
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 0aedbcaf6f182690790d98d90d5fe1e64c846c34 upstream.

Add additional length checks on firmware events to create more
robust code.

Reviewed-by: Arend Van Spriel &lt;arend@broadcom.com&gt;
Reviewed-by: Franky (Zhenhui) Lin &lt;frankyl@broadcom.com&gt;
Reviewed-by: Pieter-Paul Giesberts &lt;pieterpg@broadcom.com&gt;
Reviewed-by: Lei Zhang &lt;leizh@broadcom.com&gt;
Signed-off-by: Hante Meuleman &lt;meuleman@broadcom.com&gt;
Signed-off-by: Arend van Spriel &lt;arend@broadcom.com&gt;
Signed-off-by: Kalle Valo &lt;kvalo@codeaurora.org&gt;
[bwh: Backported to 4.4:
 - Drop changes to brcmf_wowl_nd_results()
 - Adjust filenames]
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: fix race during disconnect when USB completion is in progress</title>
<updated>2019-06-11T10:24:02+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=0a597d2badef458be4fa717af55c4b9347fed9e6'/>
<id>0a597d2badef458be4fa717af55c4b9347fed9e6</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-06-11T10:24:02+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=f95ab00ab455fa8f3022dd9ddaf128ea2c841bba'/>
<id>f95ab00ab455fa8f3022dd9ddaf128ea2c841bba</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>
<entry>
<title>b43: shut up clang -Wuninitialized variable warning</title>
<updated>2019-06-11T10:24:02+00:00</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2019-03-22T14:37:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=db74ef82ca8b21a4b007dbecbd3eace3f17ee894'/>
<id>db74ef82ca8b21a4b007dbecbd3eace3f17ee894</id>
<content type='text'>
[ Upstream commit d825db346270dbceef83b7b750dbc29f1d7dcc0e ]

Clang warns about what is clearly a case of passing an uninitalized
variable into a static function:

drivers/net/wireless/broadcom/b43/phy_lp.c:1852:23: error: variable 'gains' is uninitialized when used here
      [-Werror,-Wuninitialized]
                lpphy_papd_cal(dev, gains, 0, 1, 30);
                                    ^~~~~
drivers/net/wireless/broadcom/b43/phy_lp.c:1838:2: note: variable 'gains' is declared here
        struct lpphy_tx_gains gains, oldgains;
        ^
1 error generated.

However, this function is empty, and its arguments are never evaluated,
so gcc in contrast does not warn here. Both compilers behave in a
reasonable way as far as I can tell, so we should change the code
to avoid the warning everywhere.

We could just eliminate the lpphy_papd_cal() function entirely,
given that it has had the TODO comment in it for 10 years now
and is rather unlikely to ever get done. I'm doing a simpler
change here, and just pass the 'oldgains' variable in that has
been initialized, based on the guess that this is what was
originally meant.

Fixes: 2c0d6100da3e ("b43: LP-PHY: Begin implementing calibration &amp; software RFKILL support")
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Acked-by: Larry Finger &lt;Larry.Finger@lwfinger.net&gt;
Reviewed-by: Nathan Chancellor &lt;natechancellor@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 d825db346270dbceef83b7b750dbc29f1d7dcc0e ]

Clang warns about what is clearly a case of passing an uninitalized
variable into a static function:

drivers/net/wireless/broadcom/b43/phy_lp.c:1852:23: error: variable 'gains' is uninitialized when used here
      [-Werror,-Wuninitialized]
                lpphy_papd_cal(dev, gains, 0, 1, 30);
                                    ^~~~~
drivers/net/wireless/broadcom/b43/phy_lp.c:1838:2: note: variable 'gains' is declared here
        struct lpphy_tx_gains gains, oldgains;
        ^
1 error generated.

However, this function is empty, and its arguments are never evaluated,
so gcc in contrast does not warn here. Both compilers behave in a
reasonable way as far as I can tell, so we should change the code
to avoid the warning everywhere.

We could just eliminate the lpphy_papd_cal() function entirely,
given that it has had the TODO comment in it for 10 years now
and is rather unlikely to ever get done. I'm doing a simpler
change here, and just pass the 'oldgains' variable in that has
been initialized, based on the guess that this is what was
originally meant.

Fixes: 2c0d6100da3e ("b43: LP-PHY: Begin implementing calibration &amp; software RFKILL support")
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Acked-by: Larry Finger &lt;Larry.Finger@lwfinger.net&gt;
Reviewed-by: Nathan Chancellor &lt;natechancellor@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 missing checks for kmemdup</title>
<updated>2019-06-11T10:24:02+00:00</updated>
<author>
<name>Kangjie Lu</name>
<email>kjlu@umn.edu</email>
</author>
<published>2019-03-15T17:04:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=951fbf92381a08651f2519832d0ed0f3bf83254d'/>
<id>951fbf92381a08651f2519832d0ed0f3bf83254d</id>
<content type='text'>
[ Upstream commit 46953f97224d56a12ccbe9c6acaa84ca0dab2780 ]

In case kmemdup fails, the fix sets conn_info-&gt;req_ie_len and
conn_info-&gt;resp_ie_len to zero to avoid buffer overflows.

Signed-off-by: Kangjie Lu &lt;kjlu@umn.edu&gt;
Acked-by: Arend van Spriel &lt;arend.vanspriel@broadcom.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 46953f97224d56a12ccbe9c6acaa84ca0dab2780 ]

In case kmemdup fails, the fix sets conn_info-&gt;req_ie_len and
conn_info-&gt;resp_ie_len to zero to avoid buffer overflows.

Signed-off-by: Kangjie Lu &lt;kjlu@umn.edu&gt;
Acked-by: Arend van Spriel &lt;arend.vanspriel@broadcom.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>
