mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jiri Kosina <jikos@kernel.org>,
	Johannes Berg <johannes@sipsolutions.net>
Cc: kbuild-all@lists.01.org, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mac80211: fix RCU usage in ieee80211_tx_h_select_key()
Date: Wed, 16 Feb 2022 05:06:13 +0800	[thread overview]
Message-ID: <202202160406.p1c7XduC-lkp@intel.com> (raw)
In-Reply-To: <nycvar.YFH.7.76.2202151643220.11721@cbobk.fhfr.pm>

Hi Jiri,

I love your patch! Perhaps something to improve:

[auto build test WARNING on wireless-next/main]
[also build test WARNING on wireless/main jberg-mac80211-next/master jberg-mac80211/master v5.17-rc4 next-20220215]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jiri-Kosina/mac80211-fix-RCU-usage-in-ieee80211_tx_h_select_key/20220215-234935
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
config: i386-randconfig-s002-20220214 (https://download.01.org/0day-ci/archive/20220216/202202160406.p1c7XduC-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/cdfe17d7fc283e125686bdd9a6bbc6fd60909bd7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jiri-Kosina/mac80211-fix-RCU-usage-in-ieee80211_tx_h_select_key/20220215-234935
        git checkout cdfe17d7fc283e125686bdd9a6bbc6fd60909bd7
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash net/mac80211/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> net/mac80211/tx.c:652:29: sparse: sparse: incorrect type in assignment (different base types) @@     expected int ret @@     got restricted ieee80211_tx_result [usertype] @@
   net/mac80211/tx.c:652:29: sparse:     expected int ret
   net/mac80211/tx.c:652:29: sparse:     got restricted ieee80211_tx_result [usertype]
   net/mac80211/tx.c:661:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected int ret @@     got restricted ieee80211_tx_result [usertype] @@
   net/mac80211/tx.c:661:21: sparse:     expected int ret
   net/mac80211/tx.c:661:21: sparse:     got restricted ieee80211_tx_result [usertype]
   net/mac80211/tx.c:664:13: sparse: sparse: incorrect type in assignment (different base types) @@     expected int ret @@     got restricted ieee80211_tx_result [usertype] @@
   net/mac80211/tx.c:664:13: sparse:     expected int ret
   net/mac80211/tx.c:664:13: sparse:     got restricted ieee80211_tx_result [usertype]
>> net/mac80211/tx.c:667:16: sparse: sparse: incorrect type in return expression (different base types) @@     expected restricted ieee80211_tx_result @@     got int ret @@
   net/mac80211/tx.c:667:16: sparse:     expected restricted ieee80211_tx_result
   net/mac80211/tx.c:667:16: sparse:     got int ret

vim +652 net/mac80211/tx.c

   579	
   580	static ieee80211_tx_result debug_noinline
   581	ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
   582	{
   583		int ret;
   584		struct ieee80211_key *key;
   585		struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
   586		struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
   587	
   588		if (unlikely(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) {
   589			tx->key = NULL;
   590			return TX_CONTINUE;
   591		}
   592	
   593		rcu_read_lock();
   594	
   595		if (tx->sta &&
   596		    (key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx])))
   597			tx->key = key;
   598		else if (ieee80211_is_group_privacy_action(tx->skb) &&
   599			(key = rcu_dereference(tx->sdata->default_multicast_key)))
   600			tx->key = key;
   601		else if (ieee80211_is_mgmt(hdr->frame_control) &&
   602			 is_multicast_ether_addr(hdr->addr1) &&
   603			 ieee80211_is_robust_mgmt_frame(tx->skb) &&
   604			 (key = rcu_dereference(tx->sdata->default_mgmt_key)))
   605			tx->key = key;
   606		else if (is_multicast_ether_addr(hdr->addr1) &&
   607			 (key = rcu_dereference(tx->sdata->default_multicast_key)))
   608			tx->key = key;
   609		else if (!is_multicast_ether_addr(hdr->addr1) &&
   610			 (key = rcu_dereference(tx->sdata->default_unicast_key)))
   611			tx->key = key;
   612		else
   613			tx->key = NULL;
   614	
   615		if (tx->key) {
   616			bool skip_hw = false;
   617	
   618			/* TODO: add threshold stuff again */
   619	
   620			switch (tx->key->conf.cipher) {
   621			case WLAN_CIPHER_SUITE_WEP40:
   622			case WLAN_CIPHER_SUITE_WEP104:
   623			case WLAN_CIPHER_SUITE_TKIP:
   624				if (!ieee80211_is_data_present(hdr->frame_control))
   625					tx->key = NULL;
   626				break;
   627			case WLAN_CIPHER_SUITE_CCMP:
   628			case WLAN_CIPHER_SUITE_CCMP_256:
   629			case WLAN_CIPHER_SUITE_GCMP:
   630			case WLAN_CIPHER_SUITE_GCMP_256:
   631				if (!ieee80211_is_data_present(hdr->frame_control) &&
   632				    !ieee80211_use_mfp(hdr->frame_control, tx->sta,
   633						       tx->skb) &&
   634				    !ieee80211_is_group_privacy_action(tx->skb))
   635					tx->key = NULL;
   636				else
   637					skip_hw = (tx->key->conf.flags &
   638						   IEEE80211_KEY_FLAG_SW_MGMT_TX) &&
   639						ieee80211_is_mgmt(hdr->frame_control);
   640				break;
   641			case WLAN_CIPHER_SUITE_AES_CMAC:
   642			case WLAN_CIPHER_SUITE_BIP_CMAC_256:
   643			case WLAN_CIPHER_SUITE_BIP_GMAC_128:
   644			case WLAN_CIPHER_SUITE_BIP_GMAC_256:
   645				if (!ieee80211_is_mgmt(hdr->frame_control))
   646					tx->key = NULL;
   647				break;
   648			}
   649	
   650			if (unlikely(tx->key && tx->key->flags & KEY_FLAG_TAINTED &&
   651				     !ieee80211_is_deauth(hdr->frame_control))) {
 > 652				ret = TX_DROP;
   653				goto out;
   654			}
   655	
   656			if (!skip_hw && tx->key &&
   657			    tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)
   658				info->control.hw_key = &tx->key->conf;
   659		} else if (ieee80211_is_data_present(hdr->frame_control) && tx->sta &&
   660			   test_sta_flag(tx->sta, WLAN_STA_USES_ENCRYPTION)) {
   661			ret = TX_DROP;
   662			goto out;
   663		}
   664		ret = TX_CONTINUE;
   665	out:
   666		rcu_read_unlock();
 > 667		return ret;
   668	}
   669	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

      parent reply	other threads:[~2022-02-15 21:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 15:47 Jiri Kosina
2022-02-15 15:50 ` Johannes Berg
2022-02-15 16:11   ` [PATCH] rtw89: fix RCU usage in rtw89_core_txq_push() (was Re: [PATCH] mac80211: fix RCU usage in ieee80211_tx_h_select_key()) Jiri Kosina
2022-02-15 17:27     ` Kalle Valo
2022-02-16 15:27       ` Jiri Kosina
2022-02-15 21:06 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202202160406.p1c7XduC-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jikos@kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®