3649bdda492ef924920d71cbf81b00ea9ddbf636
[openwrt/staging/neocturne.git] /
1 From 5c3de777bdaf48bd0cfb43097c0d0fb85056cab7 Mon Sep 17 00:00:00 2001
2 From: Arend Van Spriel <arend.vanspriel@broadcom.com>
3 Date: Sat, 25 Nov 2017 21:39:25 +0100
4 Subject: [PATCH] brcmfmac: change driver unbind order of the sdio function
5 devices
6
7 In the function brcmf_sdio_firmware_callback() the driver is
8 unbound from the sdio function devices in the error path.
9 However, the order in which it is done resulted in a use-after-free
10 issue (see brcmf_ops_sdio_remove() in bcmsdh.c). Hence change
11 the order and first unbind sdio function #2 device and then
12 unbind sdio function #1 device.
13
14 Cc: stable@vger.kernel.org # v4.12.x
15 Fixes: 7a51461fc2da ("brcmfmac: unbind all devices upon failure in firmware callback")
16 Reported-by: Stefan Wahren <stefan.wahren@i2se.com>
17 Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
18 Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
19 Reviewed-by: Franky Lin <franky.lin@broadcom.com>
20 Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
21 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
22 ---
23 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +-
24 1 file changed, 1 insertion(+), 1 deletion(-)
25
26 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
27 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
28 @@ -4121,8 +4121,8 @@ release:
29 sdio_release_host(sdiodev->func[1]);
30 fail:
31 brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err);
32 - device_release_driver(dev);
33 device_release_driver(&sdiodev->func[2]->dev);
34 + device_release_driver(dev);
35 }
36
37 struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)