[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220725113701.18774af6@kernel.org>
Date: Mon, 25 Jul 2022 11:37:01 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Maxim Mikityanskiy <maximmi@...dia.com>
Cc: Tariq Toukan <tariqt@...dia.com>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Boris Pismenny <borisp@...dia.com>,
"john.fastabend@...il.com" <john.fastabend@...il.com>,
"davem@...emloft.net" <davem@...emloft.net>
Subject: Re: [PATCH net] net/tls: Remove the context from the list in
tls_device_down
On Mon, 25 Jul 2022 14:35:08 +0000 Maxim Mikityanskiy wrote:
> On Fri, 2022-07-22 at 15:04 -0700, Jakub Kicinski wrote:
> > On Thu, 21 Jul 2022 12:11:27 +0300 Maxim Mikityanskiy wrote:
> > > tls_device_down takes a reference on all contexts it's going to move to
> > > the degraded state (software fallback). If sk_destruct runs afterwards,
> > > it can reduce the reference counter back to 1 and return early without
> > > destroying the context. Then tls_device_down will release the reference
> > > it took and call tls_device_free_ctx. However, the context will still
> > > stay in tls_device_down_list forever. The list will contain an item,
> > > memory for which is released, making a memory corruption possible.
> > >
> > > Fix the above bug by properly removing the context from all lists before
> > > any call to tls_device_free_ctx.
> >
> > SGTM. The tls_device_down_list has no use, tho, is the plan to remove
> > it later as a cleanup or your upcoming patches make use of it?
>
> I don't plan to remove it. Right, we never iterate over it, so instead
> of moving the context to tls_device_down_list, we can remove it from
> list, as long as we check to not remove it second time on destruction.
>
> However, this way we don't gain anything, but lose a debugging
> opportunity: for example, when list debugging is enabled, double
> list_del will be detected.
I see. I haven't actually checked if list_del_init() would do as well
here.
> So, it doesn't make sense to me to remove this list, but if you still
> want to do it, Tariq has a patch for this.
Fine either way, thanks for the explanation.
Powered by blists - more mailing lists