diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2017-11-10 14:14:06 +1100 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2017-11-14 07:00:47 +0100 |
commit | 0e74aa1d79a5bbc663e03a2804399cae418a0321 (patch) | |
tree | 64b09a5e527e0e1d1b51b8eaec8abb9491cfc4f4 /net/xfrm/xfrm_policy.c | |
parent | b39545684a90ef3374abc0969d64c7bc540d128d (diff) | |
download | lwn-0e74aa1d79a5bbc663e03a2804399cae418a0321.tar.gz lwn-0e74aa1d79a5bbc663e03a2804399cae418a0321.zip |
xfrm: Copy policy family in clone_policy
The syzbot found an ancient bug in the IPsec code. When we cloned
a socket policy (for example, for a child TCP socket derived from a
listening socket), we did not copy the family field. This results
in a live policy with a zero family field. This triggers a BUG_ON
check in the af_key code when the cloned policy is retrieved.
This patch fixes it by copying the family field over.
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/xfrm/xfrm_policy.c')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 6eb228a70131..2a6093840e7e 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -1306,6 +1306,7 @@ static struct xfrm_policy *clone_policy(const struct xfrm_policy *old, int dir) newp->xfrm_nr = old->xfrm_nr; newp->index = old->index; newp->type = old->type; + newp->family = old->family; memcpy(newp->xfrm_vec, old->xfrm_vec, newp->xfrm_nr*sizeof(struct xfrm_tmpl)); spin_lock_bh(&net->xfrm.xfrm_policy_lock); |