From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385038; b=2ceOoDelwk491a6ff+GcF2qRVkPd6Hm4sunoHyZniO1sUpuHbOO1sK7DYMXgleY6h4Yw gsvAjvx2CoJcmxFHP4YDBPhiSQVkfcYIBmKJHltaN+SF+zN7o0HMbY3g7EnlrsjNVpD2m ESbaOnWW0D2iqfWYLmTPDBEu2OjW5dkxVef0inhRypphiU2VnA5lx1GuKZydoWA/IhXXb 7S3FnKooMdYgErtpfRkAojnozOv+NihWUgillpr6MY8VjEdwi+uQp7NxNTjG9BD+rTl4W wbuHzkVpd1QIZQue1Hd4pHsT8brjwrfU0kElD9agezFq6FiqYNo7feuui+5AsDIk4eg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385038; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=VD0RD5bA1z9OTCA0Ny8UJRYYNpCa5UIt0hXgfmh2/4g=; b=umtIhRJ/Hghzh4tfImdrBtDuiMkJokV8ZQf8m2YPGsmTZFLcoYtdm77VyEzdXZ3D7bAX 5vFa12+SiG0CRoUqgkBmNY6idxBzWRU3XSLEHU+WBOlcR+oXEwPXChjBEL/s3/e95GiSh WpvRN5ZaeLP14IWHbHS6wb7dJcUf2rp1X14+XJxlsSwAK8lXtmvKpORDliaSUDqq8QFWv qnGWSZHXB6/VF4YcBb+bcclzbMFLGLsiLTHKAjWQHNhKjNwA78f67FvOp1p2yecro0d9Y YDov4RPW2sIcwQTK+iixN0Q6P0rfzd83TILGb1EjUIsvRHfFhJSquX2GTeBnqJBZTvg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=YGZ7Pq92; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C347606A322; Fri, 4 Dec 2026 11:50:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=YGZ7Pq92 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 506D41F000C2; Fri, 4 Dec 2026 11:50:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385037; bh=VD0RD5bA1z9OTCA0Ny8UJRYYNpCa5UIt0hXgfmh2/4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YGZ7Pq92/a1btgLmC2lQkqFDVVxRgkNIovJ29/hdhhLXsWZCJ/Yv2pdcsJR+Cl6/J SVklShu4CaLgbqJE/q9u+F+ED/HzNjQw7lT83vtPB4GeORe1WgA2ziv6WnLfBUlEO+ 30+E9Qz5wMCY7J1PdsS45bfYe2+Y9Bi/gjcrwEuY= 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.6 0393/1167] RDMA/core: Clear driver_udata before destroying objects in rdma_core Date: Fri, 4 Dec 2026 18:57:00 +0900 Message-ID: <20261204100712.263943136@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jacob Moroni [ Upstream commit d37e98844afea39a9614cac0de837701263c90f7 ] When uobject creation fails while copying user output data (i.e., after the HW object has been created), it calls rdma_alloc_abort_uobject() with hw_obj_valid=true which then invokes the object's destroy callback, but passes the uverbs_attr_bundle from the original creation command. The issue is that drivers are expected to validate the udata and return an error if there's unexpected content, and data from the wrong command counts as "unexpected content", so this ends up causing the driver's destroy call to fail. A similar issue exists in the rereg_mr path when a new MR is created and the old one is destroyed. Fix this by clearing driver_udata before invoking the driver's destroy method. Fixes: 6e0954b11c05 ("RDMA/uverbs: Allow drivers to create a new HW object during rereg_mr") Fixes: 0ac8903cbbe6 ("RDMA/core: Allow the ioctl layer to abort a fully created uobject") Signed-off-by: Jacob Moroni Link: https://patch.msgid.link/20261006152908.888059-1-jmoroni@google.com Signed-off-by: Leon Romanovsky [ sashal: Only the two uverbs_get_cleared_udata(attrs) calls in rdma_core.c were applied. The upstream inline-helper move and the create_qp() cleanup were dropped because the helper already exists out-of-line here. ] Signed-off-by: Sasha Levin --- drivers/infiniband/core/rdma_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/core/rdma_core.c b/drivers/infiniband/core/rdma_core.c index 29b1ab1d5f933..54d008e9ae85a 100644 --- a/drivers/infiniband/core/rdma_core.c +++ b/drivers/infiniband/core/rdma_core.c @@ -687,6 +687,7 @@ void rdma_assign_uobject(struct ib_uobject *to_uobj, struct ib_uobject *new_uobj * If this fails then the uobject is still completely valid (though with * a new ID) and we leak it until context close. */ + uverbs_get_cleared_udata(attrs); uverbs_destroy_uobject(to_uobj, RDMA_REMOVE_DESTROY, attrs); } @@ -702,6 +703,7 @@ void rdma_alloc_abort_uobject(struct ib_uobject *uobj, int ret; if (hw_obj_valid) { + uverbs_get_cleared_udata(attrs); ret = uobj->uapi_object->type_class->destroy_hw( uobj, RDMA_REMOVE_ABORT, attrs); /* -- 2.53.0