2
0

305-v4.15-brcmfmac-change-driver-unbind-order-of-the-sdio-func.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From 5c3de777bdaf48bd0cfb43097c0d0fb85056cab7 Mon Sep 17 00:00:00 2001
  2. From: Arend Van Spriel <[email protected]>
  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. In the function brcmf_sdio_firmware_callback() the driver is
  7. unbound from the sdio function devices in the error path.
  8. However, the order in which it is done resulted in a use-after-free
  9. issue (see brcmf_ops_sdio_remove() in bcmsdh.c). Hence change
  10. the order and first unbind sdio function #2 device and then
  11. unbind sdio function #1 device.
  12. Cc: [email protected] # v4.12.x
  13. Fixes: 7a51461fc2da ("brcmfmac: unbind all devices upon failure in firmware callback")
  14. Reported-by: Stefan Wahren <[email protected]>
  15. Reviewed-by: Hante Meuleman <[email protected]>
  16. Reviewed-by: Pieter-Paul Giesberts <[email protected]>
  17. Reviewed-by: Franky Lin <[email protected]>
  18. Signed-off-by: Arend van Spriel <[email protected]>
  19. Signed-off-by: Kalle Valo <[email protected]>
  20. ---
  21. drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +-
  22. 1 file changed, 1 insertion(+), 1 deletion(-)
  23. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  24. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
  25. @@ -4121,8 +4121,8 @@ release:
  26. sdio_release_host(sdiodev->func[1]);
  27. fail:
  28. brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err);
  29. - device_release_driver(dev);
  30. device_release_driver(&sdiodev->func[2]->dev);
  31. + device_release_driver(dev);
  32. }
  33. struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)