Skip to content

Commit 5c3de77

Browse files
Arend Van SprielKalle Valo
authored andcommitted
brcmfmac: change driver unbind order of the sdio function devices
In the function brcmf_sdio_firmware_callback() the driver is unbound from the sdio function devices in the error path. However, the order in which it is done resulted in a use-after-free issue (see brcmf_ops_sdio_remove() in bcmsdh.c). Hence change the order and first unbind sdio function #2 device and then unbind sdio function #1 device. Cc: stable@vger.kernel.org # v4.12.x Fixes: 7a51461 ("brcmfmac: unbind all devices upon failure in firmware callback") Reported-by: Stefan Wahren <stefan.wahren@i2se.com> Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com> Reviewed-by: Franky Lin <franky.lin@broadcom.com> Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
1 parent e487547 commit 5c3de77

File tree

1 file changed

+1
-1
lines changed
  • drivers/net/wireless/broadcom/brcm80211/brcmfmac

1 file changed

+1
-1
lines changed

drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4121,8 +4121,8 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err,
41214121
sdio_release_host(sdiodev->func[1]);
41224122
fail:
41234123
brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err);
4124-
device_release_driver(dev);
41254124
device_release_driver(&sdiodev->func[2]->dev);
4125+
device_release_driver(dev);
41264126
}
41274127

41284128
struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)

0 commit comments

Comments
 (0)