public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: kernel-janitors@vger.kernel.org, linux-rdma@vger.kernel.org,
	Cheng Xu <chengyou@linux.alibaba.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	Kai Shen <kaishen@linux.alibaba.com>,
	Leon Romanovsky <leon@kernel.org>,
	Yang Li <yang.lee@linux.alibaba.com>
Cc: cocci@inria.fr, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] RDMA/erdma: Prevent use-after-free in erdma_accept_newconn()
Date: Wed, 5 Mar 2025 15:20:41 +0100	[thread overview]
Message-ID: <20a1a47c-8906-44e8-92e6-9b3e698b1491@web.de> (raw)
In-Reply-To: <167179d0-e1ea-39a8-4143-949ad57294c2@linux.alibaba.com>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 5 Mar 2025 15:07:51 +0100

The implementation of the function “erdma_accept_newconn” contained
still the statement “new_cep->sock = NULL” after
the function call “erdma_cep_put(new_cep)”.
Thus delete an inappropriate reset action.

Reported-by: Cheng Xu <chengyou@linux.alibaba.com>
Link: https://lore.kernel.org/cocci/167179d0-e1ea-39a8-4143-949ad57294c2@linux.alibaba.com/
Link: https://lkml.org/lkml/2023/3/19/191
Fixes: 920d93eac8b9 ("RDMA/erdma: Add connection management (CM) support")
Cc: stable@vger.kernel.org
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/infiniband/hw/erdma/erdma_cm.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/infiniband/hw/erdma/erdma_cm.c b/drivers/infiniband/hw/erdma/erdma_cm.c
index 1b23c698ec25..e0acc185e719 100644
--- a/drivers/infiniband/hw/erdma/erdma_cm.c
+++ b/drivers/infiniband/hw/erdma/erdma_cm.c
@@ -709,7 +709,6 @@ static void erdma_accept_newconn(struct erdma_cep *cep)
 		erdma_cancel_mpatimer(new_cep);

 		erdma_cep_put(new_cep);
-		new_cep->sock = NULL;
 	}

 	if (new_s) {
--
2.48.1


  reply	other threads:[~2025-03-05 14:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <f9303bdc-b1a7-be5e-56c6-dfa8232b8b55@web.de>
     [not found] ` <afe30fc6-04c9-528c-f84a-67902b5a6ed8@web.de>
2023-03-19 11:40   ` [PATCH] RDMA/siw: Fix exception handling in siw_accept_newconn() Leon Romanovsky
     [not found]     ` <1c06e86d-1468-c11a-8344-9563ad6047b5@web.de>
2023-03-19 14:11       ` Leon Romanovsky
     [not found]         ` <a03c1d04-a41e-7722-c36a-bd6f61094702@web.de>
2023-03-19 17:37           ` Leon Romanovsky
     [not found] ` <f0f96f74-21d1-f5bf-1086-1c3ce0ea18f5@web.de>
2023-03-19 11:41   ` [PATCH] RDMA/erdma: Fix exception handling in erdma_accept_newconn() Leon Romanovsky
2023-03-19 13:36   ` Cheng Xu
2025-03-05 14:20     ` Markus Elfring [this message]
2025-03-06  8:47       ` [PATCH] RDMA/erdma: Prevent use-after-free " Leon Romanovsky
2025-03-06 12:06         ` Cheng Xu
     [not found] ` <8f785de5-ebe2-edd9-2155-f440acacc643@web.de>
     [not found]   ` <01af2ec9-4758-1fe6-0d74-b30b95c3e9a5@web.de>
2023-04-09  9:59     ` [PATCH 0/2] IB/uverbs: Adjustments for create_qp() Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20a1a47c-8906-44e8-92e6-9b3e698b1491@web.de \
    --to=markus.elfring@web.de \
    --cc=chengyou@linux.alibaba.com \
    --cc=cocci@inria.fr \
    --cc=jgg@ziepe.ca \
    --cc=kaishen@linux.alibaba.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=yang.lee@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox