Skip to contentSkip to conversation

mac80211: add generic cipher scheme support

DISCUSSION Dan Carpenter 2 participants 2 messages Jul 8, 2014

lore
Share & tools
lore
#0 lore raw

Hello Max Stepanov,

This is a semi-automatic email about new static checker warnings.

The patch 2475b1cc0d52: "mac80211: add generic cipher scheme support" from Mar 24, 2013, leads to the following Smatch complaint:

net/mac80211/rx.c:1551 ieee80211_rx_h_decrypt()

	 error: we previously assumed 'rx->sta' could be null (see line 1401)

net/mac80211/rx.c
1400

  1401		if (rx->sta) {
                    ^^^^^^^

Many places in this function assume that ->sta can be NULL.

  1402			int keyid = rx->sta->ptk_idx;
  1403	
  1404			if (ieee80211_has_protected(fc) && rx->sta->cipher_scheme) {
  1405				cs = rx->sta->cipher_scheme;
  1406				keyid = iwl80211_get_cs_keyid(cs, rx->skb);

[ snip ]

1547 case WLAN_CIPHER_SUITE_AES_CMAC:
1548 result = ieee80211_crypto_aes_cmac_decrypt(rx);
1549 break;
1550 default:

  1551			result = ieee80211_crypto_hw_decrypt(rx);
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

But if it's NULL here then we will Oops.

1552 }
1553

regards,
dan carpenter

#1 lore raw
Quoted 9 lines

This is a semi-automatic email about new static checker warnings.

The patch 2475b1cc0d52: "mac80211: add generic cipher scheme support" from Mar 24, 2013, leads to the following Smatch complaint:

net/mac80211/rx.c:1551 ieee80211_rx_h_decrypt()

	 error: we previously assumed 'rx->sta' could be null (see line 1401)

...
1551 result = ieee80211_crypto_hw_decrypt(rx);

                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ But if it's NULL here then we will Oops.

Thank you Dan. I'll add verification of rx->sta == NULL to ieee80211_crypto_hw_decrypt().

Max