* [PATCH] iwmc3200wifi: fix NULL pointer dereference in pmkid update
@ 2009-12-01 3:48 Zhu Yi
2009-12-01 10:22 ` Samuel Ortiz
0 siblings, 1 reply; 2+ messages in thread
From: Zhu Yi @ 2009-12-01 3:48 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, Zhu Yi, Samuel Ortiz
When handling IWM_CMD_PMKID_FLUSH command, the bssid and
pmkid in pmksa are all NULL. Check it before memcpy.
Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
drivers/net/wireless/iwmc3200wifi/commands.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/iwmc3200wifi/commands.c b/drivers/net/wireless/iwmc3200wifi/commands.c
index bd06307..89b33fa 100644
--- a/drivers/net/wireless/iwmc3200wifi/commands.c
+++ b/drivers/net/wireless/iwmc3200wifi/commands.c
@@ -970,8 +970,10 @@ int iwm_send_pmkid_update(struct iwm_priv *iwm,
memset(&update, 0, sizeof(struct iwm_umac_pmkid_update));
update.command = cpu_to_le32(command);
- memcpy(&update.bssid, pmksa->bssid, ETH_ALEN);
- memcpy(&update.pmkid, pmksa->pmkid, WLAN_PMKID_LEN);
+ if (pmksa->bssid)
+ memcpy(&update.bssid, pmksa->bssid, ETH_ALEN);
+ if (pmksa->pmkid)
+ memcpy(&update.pmkid, pmksa->pmkid, WLAN_PMKID_LEN);
ret = iwm_send_wifi_if_cmd(iwm, &update,
sizeof(struct iwm_umac_pmkid_update), 0);
--
1.6.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iwmc3200wifi: fix NULL pointer dereference in pmkid update
2009-12-01 3:48 [PATCH] iwmc3200wifi: fix NULL pointer dereference in pmkid update Zhu Yi
@ 2009-12-01 10:22 ` Samuel Ortiz
0 siblings, 0 replies; 2+ messages in thread
From: Samuel Ortiz @ 2009-12-01 10:22 UTC (permalink / raw)
To: Zhu Yi; +Cc: linville, linux-wireless
On Tue, Dec 01, 2009 at 11:48:50AM +0800, Zhu Yi wrote:
> When handling IWM_CMD_PMKID_FLUSH command, the bssid and
> pmkid in pmksa are all NULL. Check it before memcpy.
>
> Cc: Samuel Ortiz <sameo@linux.intel.com>
> Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Good catch, thanks Yi.
Cheers,
Samuel.
> ---
> drivers/net/wireless/iwmc3200wifi/commands.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/iwmc3200wifi/commands.c b/drivers/net/wireless/iwmc3200wifi/commands.c
> index bd06307..89b33fa 100644
> --- a/drivers/net/wireless/iwmc3200wifi/commands.c
> +++ b/drivers/net/wireless/iwmc3200wifi/commands.c
> @@ -970,8 +970,10 @@ int iwm_send_pmkid_update(struct iwm_priv *iwm,
> memset(&update, 0, sizeof(struct iwm_umac_pmkid_update));
>
> update.command = cpu_to_le32(command);
> - memcpy(&update.bssid, pmksa->bssid, ETH_ALEN);
> - memcpy(&update.pmkid, pmksa->pmkid, WLAN_PMKID_LEN);
> + if (pmksa->bssid)
> + memcpy(&update.bssid, pmksa->bssid, ETH_ALEN);
> + if (pmksa->pmkid)
> + memcpy(&update.pmkid, pmksa->pmkid, WLAN_PMKID_LEN);
>
> ret = iwm_send_wifi_if_cmd(iwm, &update,
> sizeof(struct iwm_umac_pmkid_update), 0);
> --
> 1.6.0.4
>
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-01 10:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-01 3:48 [PATCH] iwmc3200wifi: fix NULL pointer dereference in pmkid update Zhu Yi
2009-12-01 10:22 ` Samuel Ortiz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).