From: Steffen Klassert <steffen.klassert@secunet.com>
To: David Miller <davem@davemloft.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
Steffen Klassert <steffen.klassert@secunet.com>,
<netdev@vger.kernel.org>
Subject: [PATCH 1/2] xfrm: Copy policy family in clone_policy
Date: Thu, 16 Nov 2017 11:00:39 +0100 [thread overview]
Message-ID: <1510826440-19452-2-git-send-email-steffen.klassert@secunet.com> (raw)
In-Reply-To: <1510826440-19452-1-git-send-email-steffen.klassert@secunet.com>
From: Herbert Xu <herbert@gondor.apana.org.au>
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>
---
net/xfrm/xfrm_policy.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 6eb228a..2a60938 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);
--
2.7.4
next prev parent reply other threads:[~2017-11-16 10:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-16 10:00 pull request (net): ipsec 2017-11-16 Steffen Klassert
2017-11-16 10:00 ` Steffen Klassert [this message]
2017-11-16 10:00 ` [PATCH 2/2] Revert "xfrm: Fix stack-out-of-bounds read in xfrm_state_find." Steffen Klassert
2017-12-23 9:22 ` Steffen Klassert
2017-12-23 15:56 ` David Miller
2017-12-23 16:09 ` Steffen Klassert
2017-12-23 18:10 ` robsonde
2018-01-05 16:12 ` Nicolas Dichtel
2018-01-05 17:17 ` David Miller
2018-01-08 16:06 ` Nicolas Dichtel
2017-11-16 13:34 ` pull request (net): ipsec 2017-11-16 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1510826440-19452-2-git-send-email-steffen.klassert@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox