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-next>] [day] [month] [year] [list]
Message-Id: <7f93f2a2c2fd18ddfeb99339d175b85ffd1c6398.1626713915.git.christophe.jaillet@wanadoo.fr>
Date:   Mon, 19 Jul 2021 19:02:15 +0200
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     mustafa.ismail@...el.com, shiraz.saleem@...el.com,
        dledford@...hat.com, jgg@...pe.ca
Cc:     linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH] RDMA/irdma: Improve the way 'cqp_request' structures are cleaned when they are recycled

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.

This also saves this memset in the case that the 'cqp_avail_reqs' list is
empty and a new 'cqp_request' structure must be allocated. This memset is
useless, because the structure is already kzalloc'ed.

Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
 drivers/infiniband/hw/irdma/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/irdma/utils.c b/drivers/infiniband/hw/irdma/utils.c
index 5bbe44e54f9a..66711024d38b 100644
--- a/drivers/infiniband/hw/irdma/utils.c
+++ b/drivers/infiniband/hw/irdma/utils.c
@@ -445,7 +445,6 @@ struct irdma_cqp_request *irdma_alloc_and_get_cqp_request(struct irdma_cqp *cqp,
 
 	cqp_request->waiting = wait;
 	refcount_set(&cqp_request->refcnt, 1);
-	memset(&cqp_request->compl_info, 0, sizeof(cqp_request->compl_info));
 
 	return cqp_request;
 }
@@ -475,6 +474,7 @@ void irdma_free_cqp_request(struct irdma_cqp *cqp,
 		cqp_request->request_done = false;
 		cqp_request->callback_fcn = NULL;
 		cqp_request->waiting = false;
+		memset(&cqp_request->compl_info, 0, sizeof(cqp_request->compl_info));
 
 		spin_lock_irqsave(&cqp->req_lock, flags);
 		list_add_tail(&cqp_request->list, &cqp->cqp_avail_reqs);
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ