From: Nickolai Zeldovich Date: Mon, 7 Jan 2013 01:27:22 +0000 (-0500) Subject: drivers/net/wireless/mwl8k.c: avoid use-after-free X-Git-Tag: v3.8-rc4~29^2~19^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c4f74d35cac7cbc44877313b69550e2f5aeae77d;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git drivers/net/wireless/mwl8k.c: avoid use-after-free Do not dereference p->station_id after kfree(cmd) because p points into the cmd data structure. Signed-off-by: Nickolai Zeldovich Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index f221b95..83564d3 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c @@ -4250,9 +4250,11 @@ static int mwl8k_cmd_update_stadb_add(struct ieee80211_hw *hw, p->amsdu_enabled = 0; rc = mwl8k_post_cmd(hw, &cmd->header); + if (!rc) + rc = p->station_id; kfree(cmd); - return rc ? rc : p->station_id; + return rc; } static int mwl8k_cmd_update_stadb_del(struct ieee80211_hw *hw,