[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202008050931.prM92c8Q%lkp@intel.com>
Date: Wed, 5 Aug 2020 09:51:33 +0800
From: kernel test robot <lkp@...el.com>
To: Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Masahiro Yamada <yamada.masahiro@...ionext.com>
Subject: net/netfilter/nf_conncount.c:259:9: sparse: sparse: context
imbalance in 'nf_conncount_gc_list' - wrong count at exit
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4f30a60aa78410496e5ffe632a371c00f0d83a8d
commit: 80591e61a0f7e88deaada69844e4a31280c4a38f kbuild: tell sparse about the $ARCH
date: 9 months ago
config: nios2-randconfig-s031-20200805 (attached as .config)
compiler: nios2-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-117-g8c7aee71-dirty
git checkout 80591e61a0f7e88deaada69844e4a31280c4a38f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=nios2
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> net/netfilter/nf_conncount.c:259:9: sparse: sparse: context imbalance in 'nf_conncount_gc_list' - wrong count at exit
net/netfilter/nf_conncount.c: note: in included file (through include/linux/mm_types.h, include/linux/mmzone.h, include/linux/gfp.h, ...):
include/linux/rbtree.h:84:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
include/linux/rbtree.h:84:9: sparse: struct rb_node [noderef] <asn:4> *
include/linux/rbtree.h:84:9: sparse: struct rb_node *
vim +/nf_conncount_gc_list +259 net/netfilter/nf_conncount.c
cb2b36f5a97df7 Yi-Hung Wei 2018-07-02 219
2f971a8f425545 Pablo Neira Ayuso 2018-12-28 220 /* Return true if the list is empty. Must be called with BH disabled. */
5c789e131cbb99 Yi-Hung Wei 2018-07-02 221 bool nf_conncount_gc_list(struct net *net,
cb2b36f5a97df7 Yi-Hung Wei 2018-07-02 222 struct nf_conncount_list *list)
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 223 {
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 224 const struct nf_conntrack_tuple_hash *found;
cb2b36f5a97df7 Yi-Hung Wei 2018-07-02 225 struct nf_conncount_tuple *conn, *conn_n;
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 226 struct nf_conn *found_ct;
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 227 unsigned int collected = 0;
3c5cdb17c3be76 Taehee Yoo 2018-11-05 228 bool ret = false;
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 229
2f971a8f425545 Pablo Neira Ayuso 2018-12-28 230 /* don't bother if other cpu is already doing GC */
2f971a8f425545 Pablo Neira Ayuso 2018-12-28 231 if (!spin_trylock(&list->list_lock))
2f971a8f425545 Pablo Neira Ayuso 2018-12-28 232 return false;
2f971a8f425545 Pablo Neira Ayuso 2018-12-28 233
cb2b36f5a97df7 Yi-Hung Wei 2018-07-02 234 list_for_each_entry_safe(conn, conn_n, &list->head, node) {
c80f10bc973af2 Pablo Neira Ayuso 2018-12-28 235 found = find_or_evict(net, list, conn);
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 236 if (IS_ERR(found)) {
c80f10bc973af2 Pablo Neira Ayuso 2018-12-28 237 if (PTR_ERR(found) == -ENOENT)
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 238 collected++;
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 239 continue;
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 240 }
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 241
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 242 found_ct = nf_ct_tuplehash_to_ctrack(found);
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 243 if (already_closed(found_ct)) {
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 244 /*
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 245 * we do not care about connections which are
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 246 * closed already -> ditch it
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 247 */
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 248 nf_ct_put(found_ct);
c80f10bc973af2 Pablo Neira Ayuso 2018-12-28 249 conn_free(list, conn);
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 250 collected++;
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 251 continue;
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 252 }
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 253
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 254 nf_ct_put(found_ct);
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 255 if (collected > CONNCOUNT_GC_MAX_NODES)
2f971a8f425545 Pablo Neira Ayuso 2018-12-28 256 break;
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 257 }
3c5cdb17c3be76 Taehee Yoo 2018-11-05 258
c80f10bc973af2 Pablo Neira Ayuso 2018-12-28 @259 if (!list->count)
3c5cdb17c3be76 Taehee Yoo 2018-11-05 260 ret = true;
2f971a8f425545 Pablo Neira Ayuso 2018-12-28 261 spin_unlock(&list->list_lock);
3c5cdb17c3be76 Taehee Yoo 2018-11-05 262
3c5cdb17c3be76 Taehee Yoo 2018-11-05 263 return ret;
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 264 }
976afca1ceba53 Yi-Hung Wei 2018-07-02 265 EXPORT_SYMBOL_GPL(nf_conncount_gc_list);
2a406e8ac7c3e7 Yi-Hung Wei 2018-07-02 266
:::::: The code at line 259 was first introduced by commit
:::::: c80f10bc973af2ace6b1414724eeff61eaa71837 netfilter: nf_conncount: speculative garbage collection on empty lists
:::::: TO: Pablo Neira Ayuso <pablo@...filter.org>
:::::: CC: Pablo Neira Ayuso <pablo@...filter.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (23200 bytes)
Powered by blists - more mailing lists