[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220221084922.799822158@linuxfoundation.org>
Date: Mon, 21 Feb 2022 09:48:59 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Stefan Agner <stefan@...er.ch>,
Wolfgang Walter <linux@...m.de>,
Jason Self <jason@...ehome.net>,
Dominik Behr <dominik@...inikbehr.com>,
Marek Marczykowski-Górecki
<marmarek@...isiblethingslab.com>,
Johannes Berg <johannes.berg@...el.com>,
Kalle Valo <kvalo@...nel.org>
Subject: [PATCH 5.10 047/121] iwlwifi: fix use-after-free
From: Johannes Berg <johannes.berg@...el.com>
commit bea2662e7818e15d7607d17d57912ac984275d94 upstream.
If no firmware was present at all (or, presumably, all of the
firmware files failed to parse), we end up unbinding by calling
device_release_driver(), which calls remove(), which then in
iwlwifi calls iwl_drv_stop(), freeing the 'drv' struct. However
the new code I added will still erroneously access it after it
was freed.
Set 'failure=false' in this case to avoid the access, all data
was already freed anyway.
Cc: stable@...r.kernel.org
Reported-by: Stefan Agner <stefan@...er.ch>
Reported-by: Wolfgang Walter <linux@...m.de>
Reported-by: Jason Self <jason@...ehome.net>
Reported-by: Dominik Behr <dominik@...inikbehr.com>
Reported-by: Marek Marczykowski-Górecki <marmarek@...isiblethingslab.com>
Fixes: ab07506b0454 ("iwlwifi: fix leaks/bad data after failed firmware load")
Signed-off-by: Johannes Berg <johannes.berg@...el.com>
Signed-off-by: Kalle Valo <kvalo@...nel.org>
Link: https://lore.kernel.org/r/20220208114728.e6b514cf4c85.Iffb575ca2a623d7859b542c33b2a507d01554251@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -1646,6 +1646,8 @@ static void iwl_req_fw_callback(const st
out_unbind:
complete(&drv->request_firmware_complete);
device_release_driver(drv->trans->dev);
+ /* drv has just been freed by the release */
+ failure = false;
free:
if (failure)
iwl_dealloc_ucode(drv);
Powered by blists - more mailing lists