lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YPesftdeBpzJUhMZ@unreal>
Date:   Wed, 21 Jul 2021 08:11:26 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     mustafa.ismail@...el.com, shiraz.saleem@...el.com,
        dledford@...hat.com, jgg@...pe.ca, linux-rdma@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] RDMA/irdma: Improve the way 'cqp_request' structures are
 cleaned when they are recycled

On Tue, Jul 20, 2021 at 03:05:55PM +0200, Christophe JAILLET wrote:
> Le 20/07/2021 à 14:23, Leon Romanovsky a écrit :
> > On Mon, Jul 19, 2021 at 07:02:15PM +0200, Christophe JAILLET wrote:
> > > A set of IRDMA_CQP_SW_SQSIZE_2048 (i.e. 2048) 'cqp_request' are
> > > pre-allocated and zeroed in 'irdma_create_cqp()' (hw.c).  These
> > > structures are managed with the 'cqp->cqp_avail_reqs' list which keeps
> > > track of available entries.
> > > 
> > > In 'irdma_free_cqp_request()' (utils.c), when an entry is recycled and goes
> > > back to the 'cqp_avail_reqs' list, some fields are reseted.
> > > 
> > > However, one of these fields, 'compl_info', is initialized within
> > > 'irdma_alloc_and_get_cqp_request()'.
> > > 
> > > Move the corresponding memset to 'irdma_free_cqp_request()' so that the
> > > clean-up is done in only one place. This makes the logic more easy to
> > > understand.
> > 
> > I'm not so sure. The function irdma_alloc_and_get_cqp_request() returns
> > prepared cqp_request and all users expect that it will returned cleaned
> > one. The reliance on some other place to clear part of the structure is
> > prone to errors.
> 
> Ok, so maybe, moving:
> 	cqp_request->request_done = false;
> 	cqp_request->callback_fcn = NULL;
> 	cqp_request->waiting = false;
> from 'irdma_free_cqp_request()' to 'irdma_alloc_and_get_cqp_request()' to
> make explicit what is reseted makes more sense?

I think so, but it requires double check that these cleared values are
not used after irdma_free_cqp_request().

This is another reason why clearing fields after _free_ routine is
mostly wrong. It hides errors when data is accessed after release.

Thanks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ