OSDN Git Service

xfrm: don't call xfrm_policy_cache_flush while holding spinlock
authorFlorian Westphal <fw@strlen.de>
Sat, 6 Jan 2018 00:13:08 +0000 (01:13 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Feb 2018 10:07:46 +0000 (11:07 +0100)
commit85c31887a20da06fe2803b4ec1031b9af89c1899
tree94ab376d4b33ca35bd73f83943f17d1a715a9a9e
parent201941360944afbde6ab6f5ff70f96f16d334971
xfrm: don't call xfrm_policy_cache_flush while holding spinlock

commit b1bdcb59b64f806ef08d25a85c39ffb3ad841ce6 upstream.

xfrm_policy_cache_flush can sleep, so it cannot be called while holding
a spinlock.  We could release the lock first, but I don't see why we need
to invoke this function here in first place, the packet path won't reuse
an xdst entry unless its still valid.

While at it, add an annotation to xfrm_policy_cache_flush, it would
have probably caught this bug sooner.

Fixes: ec30d78c14a813 ("xfrm: add xdst pcpu cache")
Reported-by: syzbot+e149f7d1328c26f9c12f@syzkaller.appspotmail.com
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/xfrm/xfrm_policy.c