Skip to content

Commit

Permalink
iwmc3200wifi: Check for cmd pointer before dereferencing it
Browse files Browse the repository at this point in the history
The wifi_if_wrapper notification handling code uses a cmd pointer without
checking if it's valid or not. We're dereferencing it because we assume that
we only get to that point if there was a pending command for us. That's not
always true, so we'd better check.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Samuel Ortiz authored and John W. Linville committed Oct 27, 2009
1 parent f96cca8 commit 708567e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/net/wireless/iwmc3200wifi/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1057,8 +1057,14 @@ static int iwm_ntf_wifi_if_wrapper(struct iwm_priv *iwm, u8 *buf,
unsigned long buf_size,
struct iwm_wifi_cmd *cmd)
{
struct iwm_umac_wifi_if *hdr =
(struct iwm_umac_wifi_if *)cmd->buf.payload;
struct iwm_umac_wifi_if *hdr;

if (cmd == NULL) {
IWM_ERR(iwm, "Couldn't find expected wifi command\n");
return -EINVAL;
}

hdr = (struct iwm_umac_wifi_if *)cmd->buf.payload;

IWM_DBG_NTF(iwm, DBG, "WIFI_IF_WRAPPER cmd is delivered to UMAC: "
"oid is 0x%x\n", hdr->oid);
Expand Down

0 comments on commit 708567e

Please sign in to comment.