From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50B2833F5B0; Mon, 20 Apr 2026 16:06:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776701190; cv=none; b=KKRItUv6ofO39Cd/1wni+OUptlrYbNC5IWr/KMzfYfbUUXchg/acaUycWuuZrfQFddxjIbRGngi23xa5IgYFe0OfGVpoH03ngEPbkwqLLCz1GpLAv7TxLOuTjtKq+LlC+o+fRpxkY4fzINQ89aIFOuG+yvuiuKXnc4VuwemkGXg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776701190; c=relaxed/simple; bh=PJzss61xWn1QLFwmfUAPno1WKoTaRJ1hDkO7cz67Up4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qp6lqu1CbTJuhH9zPnIG+g3aylluj4a4S4C1wB+h/rLdXUK0eilLfz1dNeR07gfoDEV50ojAeKislVvPkMXVG9UosWXUSEJqe2oYUrsT1YYvBdGpqDuSmHiYuNvDbicKyuOPxGjzyHyMmTh13YRtoIya7Wvd4knVAPNARdekSSg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=C2aLXCIg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="C2aLXCIg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF015C2BCB4; Mon, 20 Apr 2026 16:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776701190; bh=PJzss61xWn1QLFwmfUAPno1WKoTaRJ1hDkO7cz67Up4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C2aLXCIgI7iaYZWt2yWmQXFz/Ae1zdEbZU5LZlHv2GIOJEkoQMHLQ82Uozbq8G85w 39WsuynNK/3w4ws9pdApnnZqWy3Dz2HagVo+Y+1vQV7CSSoEoT7yO821yk97Urf6X8 f8p/5KRh63jBHTCZvKZsm57jquLpxi1ETxzKjnC0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jacob Moroni , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.12 001/162] RDMA/irdma: Fix double free related to rereg_user_mr Date: Mon, 20 Apr 2026 17:40:33 +0200 Message-ID: <20260420153927.064140297@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260420153927.006696811@linuxfoundation.org> References: <20260420153927.006696811@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jacob Moroni [ Upstream commit 29a3edd7004bb635d299fb9bc6f0ea4ef13ed5a2 ] If IB_MR_REREG_TRANS is set during rereg_user_mr, the umem will be released and a new one will be allocated in irdma_rereg_mr_trans. If any step of irdma_rereg_mr_trans fails after the new umem is allocated, it releases the umem, but does not set iwmr->region to NULL. The problem is that this failure is propagated to the user, who will then call ibv_dereg_mr (as they should). Then, the dereg_mr path will see a non-NULL umem and attempt to call ib_umem_release again. Fix this by setting iwmr->region to NULL after ib_umem_release. Fixed: 5ac388db27c4 ("RDMA/irdma: Add support to re-register a memory region") Signed-off-by: Jacob Moroni Link: https://patch.msgid.link/20260227152743.1183388-1-jmoroni@google.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/hw/irdma/verbs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c index 1f267dea6460e..0b9cf175ed73b 100644 --- a/drivers/infiniband/hw/irdma/verbs.c +++ b/drivers/infiniband/hw/irdma/verbs.c @@ -3210,6 +3210,7 @@ static int irdma_rereg_mr_trans(struct irdma_mr *iwmr, u64 start, u64 len, err: ib_umem_release(region); + iwmr->region = NULL; return err; } -- 2.53.0