From: Antony Antony <antony.antony@secunet.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Thomas Jarosch <thomas.jarosch@intra2net.com>,
Steffen Klassert <steffen.klassert@secunet.com>,
Antony Antony <antony.antony@secunet.com>,
Sabrina Dubroca <sd@queasysnail.net>,
Leon Romanovsky <leon@kernel.org>, "Roth Mark" <rothm@mail.com>,
Zhihao Chen <chenzhihao@meizu.com>,
Tobias Brunner <tobias@strongswan.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH] xfrm: Fix oops in __xfrm_state_delete()
Date: Tue, 1 Nov 2022 20:10:21 +0100 [thread overview]
Message-ID: <Y2FvHZiWejxRiIS8@moon.secunet.de> (raw)
In-Reply-To: <Y2CjFGCHGaMMTrHu@gondor.apana.org.au>
On Tue, Nov 01, 2022 at 12:39:48 +0800, Herbert Xu wrote:
> On Mon, Oct 31, 2022 at 04:26:12PM +0100, Thomas Jarosch wrote:
> >
> > diff --git a/net/key/af_key.c b/net/key/af_key.c
> > index c85df5b958d2..65a9ede62d65 100644
> > --- a/net/key/af_key.c
> > +++ b/net/key/af_key.c
> > @@ -3382,7 +3382,7 @@ static int pfkey_send_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr,
> > hdr->sadb_msg_len = size / sizeof(uint64_t);
> > hdr->sadb_msg_errno = 0;
> > hdr->sadb_msg_reserved = 0;
> > - hdr->sadb_msg_seq = x->km.seq = get_acqseq();
This line looks very odd.
> > + hdr->sadb_msg_seq = get_acqseq();
>
> This looks broken. x->km.seq is part of the state which you are
> changing. Shouldn't you do whatever xfrm_user does in the same
> situation?
xfrm_user sets msg_seq to zero in mapping change message. seq is only useful for
acquire message. I think setting to zero would be a better fix.
- hdr->sadb_msg_seq = x->km.seq = get_acqseq();
+ hdr->sadb_msg_seq = 0;
While increasing x->km.seq in every call to pfkey_send_new_mapping()
could be an issue, would it alone explan the crash?
Tobias would pfkey_send_new_mapping() called in a default setting?
next prev parent reply other threads:[~2022-11-01 19:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-31 15:26 [PATCH] xfrm: Fix oops in __xfrm_state_delete() Thomas Jarosch
2022-11-01 4:39 ` Herbert Xu
2022-11-01 19:10 ` Antony Antony [this message]
2022-11-02 7:07 ` Herbert Xu
2022-11-02 8:31 ` Thomas Jarosch
2022-11-02 10:18 ` [PATCH v2] " Thomas Jarosch
2022-11-03 10:32 ` Antony Antony
2022-11-04 4:43 ` Herbert Xu
2022-11-17 6:32 ` Steffen Klassert
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=Y2FvHZiWejxRiIS8@moon.secunet.de \
--to=antony.antony@secunet.com \
--cc=chenzhihao@meizu.com \
--cc=herbert@gondor.apana.org.au \
--cc=leon@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rothm@mail.com \
--cc=sd@queasysnail.net \
--cc=steffen.klassert@secunet.com \
--cc=thomas.jarosch@intra2net.com \
--cc=tobias@strongswan.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.