libertas: move firmware lifetime handling to firmware.c
authorDan Williams <dcbw@redhat.com>
Mon, 14 Oct 2013 22:51:55 +0000 (17:51 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 18 Oct 2013 18:03:54 +0000 (14:03 -0400)
commit1dfba3060fe7ee03ccec25a91d35085142dfc295
treec27da4ef59aeaa75b1d39c46af0aeed4f7ba7147
parente07f01e4c7d583adb1ec25e63a52db5fc10a94d3
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>
drivers/net/wireless/libertas/firmware.c
drivers/net/wireless/libertas/if_cs.c
drivers/net/wireless/libertas/if_sdio.c
drivers/net/wireless/libertas/if_spi.c
drivers/net/wireless/libertas/if_usb.c