rtlwifi: kfree entry until after entry->bssid has been accessed
authorColin Ian King <colin.king@canonical.com>
Fri, 30 Jun 2017 10:08:43 +0000 (11:08 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 27 Jul 2017 10:58:18 +0000 (13:58 +0300)
commitd0116f6f7b306bc2d1bfc98d7c7c80fe5f468c20
tree3b6e61f28156cb110ef8b1be486f285009c594eb
parent4b5dde2d6234ff5bc68e97e6901d1f2a0a7f3749
rtlwifi: kfree entry until after entry->bssid has been accessed

The current code kfree's entry and then dereferences it by accessing
entry->bssid.  Avoid the dereference-after-free by moving the kfree
after the access to entry->bssid.

Detected by CoverityScan, CID#1448600 ("Read from pointer after free")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/base.c