[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y2FvHZiWejxRiIS8@moon.secunet.de>
Date: Tue, 1 Nov 2022 20:10:21 +0100
From: Antony Antony <antony.antony@...unet.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
CC: Thomas Jarosch <thomas.jarosch@...ra2net.com>,
Steffen Klassert <steffen.klassert@...unet.com>,
Antony Antony <antony.antony@...unet.com>,
Sabrina Dubroca <sd@...asysnail.net>,
Leon Romanovsky <leon@...nel.org>,
"Roth Mark" <rothm@...l.com>, Zhihao Chen <chenzhihao@...zu.com>,
Tobias Brunner <tobias@...ongswan.org>,
<netdev@...r.kernel.org>
Subject: Re: [PATCH] xfrm: Fix oops in __xfrm_state_delete()
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?
Powered by blists - more mailing lists