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=1796387917; b=0RC+H4TLaQyqNGRACQx3WwLH9kwRbzpwlma0AIZQVQMQ3uk1lCfqpVPOIIb+VRhewQ+Q zsAXBKpXIFV3gnm8PIR34dlB0i1NBxeoMyzC830o05Qgfg5a+bAINjfkdNUgAkgs4nFs1 iE6J9YeW4x04sfjwXOhlWgcbYs3Y3gyDq2+8U8shmSou7W/YroLO8KE4RZNGMiG4kCptq 6YhMJDnrlBf9pPOn4REbRn0xxg3ep8uy9if5nf6W4PK0/U3VCP2WsW7U/LRGRp/8ULIeP DDGnXe36ejMvNmRWFHoMW9+w/j/tiYCMTbA4rpp3mevxXg4Y71ClnSNYyJ3ZI+QWJbw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387917; 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=ELN1IRrVKh8p8Jm3XFL98usoz6zSTiuRZe0gMA/fInA=; b=BbsoiqOuwElQsu6Uhp05YN/02oVEaSNRMDWWDlA8CDeb5b6D+iHpVj0A3olSn2xTYX1o 59ox0SnmtbqxPNxEhg/8JoemK0mlbNNdpzVA/qZj1BolRQHMDmE2yeIwPIL9s6ZlOOLkc KObVmRcaIB0mWQoJDRZgkXSDRzgin4t+vxXefug+VkJcN7D79fhGqa8Vx81+24ON5zYtT 0qYhEW6UuZ8+DnaVqPmnwFD830cxAxkS1es/QEjFl7jhrHnayAG3KygU0Q+66Xuwa7ggl 4FNwpKgLtAnEIgy0wn9GuKNhkMRgOH2dHhL4BEcHLoesjNDzIfJPht+iCN6EQYouTOw== 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=aTJDT61v; 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 94D84606A322; Fri, 4 Dec 2026 12:38:37 +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=aTJDT61v Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0953C1F000CE; Fri, 4 Dec 2026 12:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387917; bh=ELN1IRrVKh8p8Jm3XFL98usoz6zSTiuRZe0gMA/fInA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aTJDT61vats779wEC67npAdZEYk6tw42KlRQaPX08eMkYSwT9Ut1hRCg5OLLlB2iO 8GAgUpWZ2OTq/F46njlPFlmxzOSgdqBT2u4mBrJfSd0nWhw+nz48YWq2yZmk0qXkpR NBRYlhiYmCfL9FfGjaoyInvo6nB7JhF+DaGJ80yY= 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.1 0370/1059] RDMA/core: Clear driver_udata before destroying objects in rdma_core Date: Fri, 4 Dec 2026 18:58:21 +0900 Message-ID: <20261204100653.865744625@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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: Backport calls the existing out-of-line uverbs_get_cleared_udata() in rdma_core.c only, skipping the header inline move and the create_qp() cleanup because this tree's layout lacks them. ] 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