From: Gustavo A. R. Silva Date: Thu, 5 Apr 2018 15:49:49 +0000 (-0500) Subject: qtnfmac: pearl: pcie: fix memory leak in qtnf_fw_work_handler X-Git-Tag: Ubuntu-5.2.0-15.16~4262^2~217^2~44 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=3763770044640caeb1101cdea40697cc0814403c;p=mirror_ubuntu-eoan-kernel.git qtnfmac: pearl: pcie: fix memory leak in qtnf_fw_work_handler In case memory resources for fw were succesfully allocated, release them before jumping to fw_load_fail. Addresses-Coverity-ID: 1466092 ("Resource leak") Fixes: c3b2f7ca4186 ("qtnfmac: implement asynchronous firmware loading") Signed-off-by: Gustavo A. R. Silva Reviewed-by: Sergey Matyukevich Signed-off-by: Kalle Valo --- diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c index f117904d9120..6c1e139bb8f7 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c +++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c @@ -1185,6 +1185,10 @@ static void qtnf_fw_work_handler(struct work_struct *work) if (qtnf_poll_state(&priv->bda->bda_ep_state, QTN_EP_FW_LOADRDY, QTN_FW_DL_TIMEOUT_MS)) { pr_err("card is not ready\n"); + + if (!flashboot) + release_firmware(fw); + goto fw_load_fail; }