Skip to content

Commit

Permalink
drivers/net/wireless/mwl8k.c: avoid use-after-free
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nickolai Zeldovich authored and John W. Linville committed Jan 7, 2013
1 parent 111b72a commit c4f74d3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/wireless/mwl8k.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c4f74d3

Please sign in to comment.