LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] net: wireless: iwlwifi: Fix double-free problems in iwl_req_fw_callback()
@ 2019-05-04  9:33 Jia-Ju Bai
  2019-05-14  5:33 ` Luca Coelho
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2019-05-04  9:33 UTC (permalink / raw)
  To: johannes.berg, emmanuel.grumbach, luciano.coelho, linuxwifi,
	kvalo, davem
  Cc: linux-wireless, netdev, linux-kernel, Jia-Ju Bai

In the error handling code of iwl_req_fw_callback(), iwl_dealloc_ucode()
is called to free data. In iwl_drv_stop(), iwl_dealloc_ucode() is called
again, which can cause double-free problems.

To fix this bug, the call to iwl_dealloc_ucode() in
iwl_req_fw_callback() is deleted.

This bug is found by a runtime fuzzing tool named FIZZER written by us.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index 689a65b11cc3..4fd1737d768b 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -1579,7 +1579,6 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
 	goto free;
 
  out_free_fw:
-	iwl_dealloc_ucode(drv);
 	release_firmware(ucode_raw);
  out_unbind:
 	complete(&drv->request_firmware_complete);
-- 
2.17.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: wireless: iwlwifi: Fix double-free problems in iwl_req_fw_callback()
  2019-05-04  9:33 [PATCH] net: wireless: iwlwifi: Fix double-free problems in iwl_req_fw_callback() Jia-Ju Bai
@ 2019-05-14  5:33 ` Luca Coelho
  0 siblings, 0 replies; 2+ messages in thread
From: Luca Coelho @ 2019-05-14  5:33 UTC (permalink / raw)
  To: Jia-Ju Bai, johannes.berg, emmanuel.grumbach, linuxwifi, kvalo, davem
  Cc: linux-wireless, netdev, linux-kernel

On Sat, 2019-05-04 at 17:33 +0800, Jia-Ju Bai wrote:
> In the error handling code of iwl_req_fw_callback(),
> iwl_dealloc_ucode()
> is called to free data. In iwl_drv_stop(), iwl_dealloc_ucode() is
> called
> again, which can cause double-free problems.
> 
> To fix this bug, the call to iwl_dealloc_ucode() in
> iwl_req_fw_callback() is deleted.
> 
> This bug is found by a runtime fuzzing tool named FIZZER written by
> us.
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
>  drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
> b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
> index 689a65b11cc3..4fd1737d768b 100644
> --- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
> +++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
> @@ -1579,7 +1579,6 @@ static void iwl_req_fw_callback(const struct
> firmware *ucode_raw, void *context)
>  	goto free;
>  
>   out_free_fw:
> -	iwl_dealloc_ucode(drv);
>  	release_firmware(ucode_raw);
>   out_unbind:
>  	complete(&drv->request_firmware_complete);

Thanks! Applied to our internal tree and will reach the mainline
following our normal upstreaming process.

--
Cheers,
Luca.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-14  5:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-04  9:33 [PATCH] net: wireless: iwlwifi: Fix double-free problems in iwl_req_fw_callback() Jia-Ju Bai
2019-05-14  5:33 ` Luca Coelho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).