iwmc3200wifi: fix NULL pointer dereference in pmkid update
PATCH 1/1 iwmc3200wifi: fix NULL pointer dereference in pmkid update
When handling IWM_CMD_PMKID_FLUSH command, the bssid and pmkid in pmksa are all NULL. Check it before memcpy.
Cc Samuel Ortiz <[email protected]>
Signed-off-by Zhu Yi <[email protected]>
--- drivers/net/wireless/iwmc3200wifi/commands.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/iwmc3200wifi/commands.c +4 -2
@@ -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 );
Signature · 1 line
1.6.0.4
Quoted 5 lines · Zhu Yi
When handling
IWM_CMD_PMKID_FLUSHcommand, the bssid and pmkid in pmksa are all NULL. Check it before memcpy.Cc Samuel Ortiz <[email protected]>Signed-off-by Zhu Yi <[email protected]>
Acked-by Samuel Ortiz <[email protected]>
Good catch, thanks Yi.
Cheers,
Samuel.
Quoted 24 lines
--- drivers/net/wireless/iwmc3200wifi/commands.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)drivers/net/wireless/iwmc3200wifi/commands.c +4
-2@@ -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 );Signature · 1 line
1.6.0.4
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/