OSDN Git Service

ipsec: Fix aborted xfrm policy dump crash
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 19 Oct 2017 12:51:10 +0000 (20:51 +0800)
committerSteffen Klassert <steffen.klassert@secunet.com>
Mon, 23 Oct 2017 07:35:48 +0000 (09:35 +0200)
commit1137b5e2529a8f5ca8ee709288ecba3e68044df2
tree18edcb35fb0f74084d002b560f91fc9deb7a44e8
parent10a7ef33679073d13bf1dd05e3f1b7912f999543
ipsec: Fix aborted xfrm policy dump crash

An independent security researcher, Mohamed Ghannam, has reported
this vulnerability to Beyond Security's SecuriTeam Secure Disclosure
program.

The xfrm_dump_policy_done function expects xfrm_dump_policy to
have been called at least once or it will crash.  This can be
triggered if a dump fails because the target socket's receive
buffer is full.

This patch fixes it by using the cb->start mechanism to ensure that
the initialisation is always done regardless of the buffer situation.

Fixes: 12a169e7d8f4 ("ipsec: Put dumpers on the dump list")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_user.c