net/xfrm/xfrm_input.c:84:9: sparse: context imbalance in 'xfrm_rcv_cb' - unexpected unlock
From: kbuild test robot
Date: Mon May 08 2017 - 23:19:09 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: bf5f89463f5b3109a72ed13ca62b57e90213387d
commit: 960fdfdeb9e85a67bed136bc945c541ba61c2bdd xfrm: input: constify xfrm_input_afinfo
date: 3 months ago
reproduce:
# apt-get install sparse
git checkout 960fdfdeb9e85a67bed136bc945c541ba61c2bdd
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
net/xfrm/xfrm_input.c:61:39: sparse: context imbalance in 'xfrm_input_get_afinfo' - different lock contexts for basic block
>> net/xfrm/xfrm_input.c:84:9: sparse: context imbalance in 'xfrm_rcv_cb' - unexpected unlock
vim +/xfrm_rcv_cb +84 net/xfrm/xfrm_input.c
2f32b51b Steffen Klassert 2014-03-14 55 spin_unlock_bh(&xfrm_input_afinfo_lock);
2f32b51b Steffen Klassert 2014-03-14 56 synchronize_rcu();
2f32b51b Steffen Klassert 2014-03-14 57 return err;
2f32b51b Steffen Klassert 2014-03-14 58 }
2f32b51b Steffen Klassert 2014-03-14 59 EXPORT_SYMBOL(xfrm_input_unregister_afinfo);
2f32b51b Steffen Klassert 2014-03-14 60
960fdfde Florian Westphal 2017-02-07 @61 static const struct xfrm_input_afinfo *xfrm_input_get_afinfo(unsigned int family)
2f32b51b Steffen Klassert 2014-03-14 62 {
960fdfde Florian Westphal 2017-02-07 63 const struct xfrm_input_afinfo *afinfo;
2f32b51b Steffen Klassert 2014-03-14 64
960fdfde Florian Westphal 2017-02-07 65 if (WARN_ON_ONCE(family >= ARRAY_SIZE(xfrm_input_afinfo)))
2f32b51b Steffen Klassert 2014-03-14 66 return NULL;
960fdfde Florian Westphal 2017-02-07 67
2f32b51b Steffen Klassert 2014-03-14 68 rcu_read_lock();
2f32b51b Steffen Klassert 2014-03-14 69 afinfo = rcu_dereference(xfrm_input_afinfo[family]);
2f32b51b Steffen Klassert 2014-03-14 70 if (unlikely(!afinfo))
2f32b51b Steffen Klassert 2014-03-14 71 rcu_read_unlock();
2f32b51b Steffen Klassert 2014-03-14 72 return afinfo;
2f32b51b Steffen Klassert 2014-03-14 73 }
2f32b51b Steffen Klassert 2014-03-14 74
2f32b51b Steffen Klassert 2014-03-14 75 static int xfrm_rcv_cb(struct sk_buff *skb, unsigned int family, u8 protocol,
2f32b51b Steffen Klassert 2014-03-14 76 int err)
2f32b51b Steffen Klassert 2014-03-14 77 {
2f32b51b Steffen Klassert 2014-03-14 78 int ret;
960fdfde Florian Westphal 2017-02-07 79 const struct xfrm_input_afinfo *afinfo = xfrm_input_get_afinfo(family);
2f32b51b Steffen Klassert 2014-03-14 80
2f32b51b Steffen Klassert 2014-03-14 81 if (!afinfo)
2f32b51b Steffen Klassert 2014-03-14 82 return -EAFNOSUPPORT;
2f32b51b Steffen Klassert 2014-03-14 83
2f32b51b Steffen Klassert 2014-03-14 @84 ret = afinfo->callback(skb, protocol, err);
960fdfde Florian Westphal 2017-02-07 85 rcu_read_unlock();
2f32b51b Steffen Klassert 2014-03-14 86
2f32b51b Steffen Klassert 2014-03-14 87 return ret;
:::::: The code at line 84 was first introduced by commit
:::::: 2f32b51b609faea1e40bb8c5bd305f1351740936 xfrm: Introduce xfrm_input_afinfo to access the the callbacks properly
:::::: TO: Steffen Klassert <steffen.klassert@xxxxxxxxxxx>
:::::: CC: Steffen Klassert <steffen.klassert@xxxxxxxxxxx>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation