brcmfmac: use local iftype avoiding use-after-free of virtual interface
authorArend Van Spriel <arend.vanspriel@broadcom.com>
Tue, 28 Mar 2017 08:11:30 +0000 (09:11 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Apr 2017 10:41:12 +0000 (12:41 +0200)
commit9afc076d281208464039eafdd99d6c53e7862236
tree9ed18bc8d44f258821b1703e8352832fdb850c11
parentc0321505df2eedfb468512d629cd198b1abc2d03
brcmfmac: use local iftype avoiding use-after-free of virtual interface

commit d77facb88448cdeaaa3adba5b9704a48ac2ac8d6 upstream.

A use-after-free was found using KASAN. In brcmf_p2p_del_if() the virtual
interface is removed using call to brcmf_remove_interface(). After that
the virtual interface instance has been freed and should not be referenced.
Solve this by storing the nl80211 iftype in local variable, which is used
in a couple of places anyway.

Reported-by: Daniel J Blueman <daniel@quora.org>
Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c