Commit 529c95cc authored by Rafał Miłecki's avatar Rafał Miłecki
Browse files

mac80211: brcmfmac: fix use-after-free & possible NULL pointer dereference



1) Using fwctx variable after brcmf_fw_request_done() was executed meant
   accessing freed memory.
2) Using fwctx->completion for the wait_for_completion_timeout() call
   could reuslt in NULL pointer dereference on fw loading error or if
   brcmf_fw_request_done() was executed quickly enough.
Signed-off-by: default avatarRafał Miłecki <rafal@milecki.pl>
parent 630d8b87
......@@ -58,12 +58,11 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
ret = request_firmware_nowait(THIS_MODULE, true, first->path,
fwctx->dev, GFP_KERNEL, fwctx,
@@ -696,6 +703,9 @@ int brcmf_fw_get_firmwares(struct device
@@ -696,6 +703,8 @@ int brcmf_fw_get_firmwares(struct device
if (ret < 0)
brcmf_fw_request_done(NULL, fwctx);
+ wait_for_completion_timeout(fwctx->completion, msecs_to_jiffies(5000));
+ fwctx->completion = NULL;
+ wait_for_completion_timeout(&completion, msecs_to_jiffies(5000));
+
return 0;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment