提交 708567e0 编写于 作者: S Samuel Ortiz 提交者: John W. Linville

iwmc3200wifi: Check for cmd pointer before dereferencing it

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: NSamuel Ortiz <sameo@linux.intel.com>
Signed-off-by: NZhu Yi <yi.zhu@intel.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 f96cca84
...@@ -1057,8 +1057,14 @@ static int iwm_ntf_wifi_if_wrapper(struct iwm_priv *iwm, u8 *buf, ...@@ -1057,8 +1057,14 @@ static int iwm_ntf_wifi_if_wrapper(struct iwm_priv *iwm, u8 *buf,
unsigned long buf_size, unsigned long buf_size,
struct iwm_wifi_cmd *cmd) struct iwm_wifi_cmd *cmd)
{ {
struct iwm_umac_wifi_if *hdr = struct iwm_umac_wifi_if *hdr;
(struct iwm_umac_wifi_if *)cmd->buf.payload;
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: " IWM_DBG_NTF(iwm, DBG, "WIFI_IF_WRAPPER cmd is delivered to UMAC: "
"oid is 0x%x\n", hdr->oid); "oid is 0x%x\n", hdr->oid);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册