xfrm: do not call rcu_read_unlock when afinfo is NULL in xfrm_get_tos
authorXin Long <lucien.xin@gmail.com>
Sat, 17 Feb 2018 07:16:22 +0000 (15:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 May 2018 05:51:58 +0000 (07:51 +0200)
commit020c32a91ee0d2744479dad9b2f8aab8a7081024
tree9981874da8927a5b92e820f72b3060d58ee55a6e
parentd0d9330fa2a382dbe09574e6d3f69d24ca242ab9
xfrm: do not call rcu_read_unlock when afinfo is NULL in xfrm_get_tos

[ Upstream commit 143a4454daaf0e80a2b9f37159a0d6d2b61e64ed ]

When xfrm_policy_get_afinfo returns NULL, it will not hold rcu
read lock. In this case, rcu_read_unlock should not be called
in xfrm_get_tos, just like other places where it's calling
xfrm_policy_get_afinfo.

Fixes: f5e2bb4f5b22 ("xfrm: policy: xfrm_get_tos cannot fail")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/xfrm/xfrm_policy.c