libertas: move firmware lifetime handling to firmware.c
Previously, each bus type was responsible for freeing the firmware structure, but some did that badly. Move responsibility for freeing firmware into firmware.c so that it's done once and correctly, instead of happening in multiple places in bus-specific code. This fixes a use-after-free bug found by Dr. H. Nikolaus Schaller where the SDIO code forgot to NULL priv->helper_fw after freeing it. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:

committed by
John W. Linville

parent
e07f01e4c7
commit
1dfba3060f
@@ -53,6 +53,11 @@ static void main_firmware_cb(const struct firmware *firmware, void *context)
|
||||
|
||||
/* Firmware found! */
|
||||
lbs_fw_loaded(priv, 0, priv->helper_fw, firmware);
|
||||
if (priv->helper_fw) {
|
||||
release_firmware (priv->helper_fw);
|
||||
priv->helper_fw = NULL;
|
||||
}
|
||||
release_firmware (firmware);
|
||||
}
|
||||
|
||||
static void helper_firmware_cb(const struct firmware *firmware, void *context)
|
||||
|
Reference in New Issue
Block a user