]> Pileus Git - ~andy/linux/commitdiff
drivers/net/wireless/mwl8k.c: avoid use-after-free
authorNickolai Zeldovich <nickolai@csail.mit.edu>
Mon, 7 Jan 2013 01:27:22 +0000 (20:27 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 7 Jan 2013 19:34:44 +0000 (14:34 -0500)
Do not dereference p->station_id after kfree(cmd) because p
points into the cmd data structure.

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwl8k.c

index f221b95b90b3c2935c67e9c272d5f1c2a89000d4..83564d36e801884bfb6d9c566653542dbe60cee4 100644 (file)
@@ -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,