From: Johannes Berg Date: Thu, 7 Oct 2010 11:00:33 +0000 (-0700) Subject: iwlagn: check beacon frame size X-Git-Tag: MMI-PSA29.97-13-9~21994^2~78^2^2~19 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=40bbfd4c1b336b8841bef9933b6e09252ace56b8;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git iwlagn: check beacon frame size When the beacon_skb is NULL, we might still attempt to use it in this code path (if we ever get here) -- make the code a bit more defensive and check the return value of iwl_fill_beacon_frame() against zero. Signed-off-by: Johannes Berg Signed-off-by: Wey-Yi Guy --- diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index 7079efbe34eb..c2636a7ab9ee 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c @@ -385,6 +385,8 @@ static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv, sizeof(frame->u) - sizeof(*tx_beacon_cmd)); if (WARN_ON_ONCE(frame_size > MAX_MPDU_SIZE)) return 0; + if (!frame_size) + return 0; /* Set up TX command fields */ tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size);