]> git.baikalelectronics.ru Git - kernel.git/commit
xfrm: Ignore socket policies when rebuilding hash tables
authorTobias Brunner <tobias@strongswan.org>
Fri, 29 Jul 2016 07:57:32 +0000 (09:57 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Fri, 29 Jul 2016 08:21:54 +0000 (10:21 +0200)
commit914ede266b5d93466f6971c57e709ad2c8e0c496
tree4f82dade86aba01201552c0a4f5051f1e03f13a6
parentefeaf46b9915e69bb5cab155717d9e9feb4e4cc7
xfrm: Ignore socket policies when rebuilding hash tables

Whenever thresholds are changed the hash tables are rebuilt.  This is
done by enumerating all policies and hashing and inserting them into
the right table according to the thresholds and direction.

Because socket policies are also contained in net->xfrm.policy_all but
no hash tables are defined for their direction (dir + XFRM_POLICY_MAX)
this causes a NULL or invalid pointer dereference after returning from
policy_hash_bysel() if the rebuild is done while any socket policies
are installed.

Since the rebuild after changing thresholds is scheduled this crash
could even occur if the userland sets thresholds seemingly before
installing any socket policies.

Fixes: 54af20ed92ef ("xfrm: Do not hash socket policies")
Signed-off-by: Tobias Brunner <tobias@strongswan.org>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_policy.c