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: <20230215101045.476291-1-n.petrova@fintech.ru>
Date:   Wed, 15 Feb 2023 13:10:45 +0300
From:   Natalia Petrova <n.petrova@...tech.ru>
To:     Jason Gunthorpe <jgg@...pe.ca>
CC:     Natalia Petrova <n.petrova@...tech.ru>,
        Leon Romanovsky <leon@...nel.org>,
        <linux-rdma@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <lvc-project@...uxtesting.org>
Subject: [PATCH] ocrdma: Fix potential null-ptr-deref in ocrdma_is_qp_in_rq_flushlist()

The 'qp->rq_cq' pointer can be equal to null in ocrdma_destroy_qp()
function. That's why 'qp->rq_cq' should be checked for null in
ocrdma_del_flush_qp() before it will be dereferenced in
ocrdma_is_qp_in_rq_flushlist().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: fe2caefcdf58 ("RDMA/ocrdma: Add driver for Emulex OneConnect IBoE RDMA adapter")
Signed-off-by: Natalia Petrova <n.petrova@...tech.ru>
---
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index dd4021b11963..a3d994ee178c 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -1660,7 +1660,7 @@ void ocrdma_del_flush_qp(struct ocrdma_qp *qp)
 	found = ocrdma_is_qp_in_sq_flushlist(qp->sq_cq, qp);
 	if (found)
 		list_del(&qp->sq_entry);
-	if (!qp->srq) {
+	if (!qp->srq && qp->rq_cq) {
 		found = ocrdma_is_qp_in_rq_flushlist(qp->rq_cq, qp);
 		if (found)
 			list_del(&qp->rq_entry);
-- 
2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ