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=1796381835; b=bYmf1PpHbn80MlnEpwQhYF8mSFDZXDLop7XsnnD+zbYLzRysM2K9bxQJ9B6MSrgjEqIT uChrRTyPwszlUF/A0RHxr0Swqp26btWJ5KGclE43+okRqu5ILWvhEKFACQJxIK+hxLiH1 atLZHt9DBHu6Qc8UcgiJO+6uG2EDJyFzVs8QIr7nCX6jxV0AhIshX8OXhOeN3679cTwvf 5TOhtxuDDxwuVpfJfkTbLID5HsWW8TqmDPyTZ9E3tNTuvXO9bRW3pq0+yQCtrhjPwX5jM pjb/dA82eyVGgne5PtuhVSJKWQjuPLt3T8erCDHk/0nikB4cwv2Jy3XxueaTCsfAx4A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381835; 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=d5mbmiuvO/V4yXy5RWZeAfo97ZV6vB3kWP1PVErvOcc=; b=h69mHrq3MBD7daVAj2T4DzD9f+QJrmaZXCVYlJ+bHzoabenzt5NmFBDWHhDOQmUxBIva l9Yny8U0uWHzjanC/leFQgN6bYwvcNEj1hMMiOUoTEAQ21zp0X4QuU6X624DBMdTMyzKw 0stcxdR1g58uV2kKDs2J1yMnwo1mSg13JwIoeUaN2XhpvBX+Mtdl/Z4OZObdNnOMEDzTU QPEmHGK+LDH/9uQ5oxbbM88oUTa/0pydz8BFgP4WuaxOSUOs30KPeer0vWMOBS7SR+hAF p+M6fMKaED9UYD1+5KZFe57XTRDPG4J5LBlMPMbRLiskWReC8SgLsbKnCybAYDSBzrQ== 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="0w/VMEaB"; 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 2D72A606A69E; Fri, 4 Dec 2026 10:57:15 +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=0w/VMEaB Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97F271F000C2; Fri, 4 Dec 2026 10:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381835; bh=d5mbmiuvO/V4yXy5RWZeAfo97ZV6vB3kWP1PVErvOcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=0w/VMEaBZ4u+8d0Z3PdcAvJqcZ6UFnRiOCpa9cus4bIZzI+vdtqEMhtGgv4jDdlBK 7FxHZzhTnUnJgk74oE96BIT/23oALrcSCAp2KH2fR6iVAo1GDCbsIC7lbzkJnjUk8A 3TcAXymiHnnr0PjEiPOrz4nSPJa+Xj810vXG7z6Y= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, SeungUk Nam , Frank Li , Vinod Koul , Sasha Levin Subject: [PATCH 6.18 195/703] dmaengine: idxd: Free the minor number when cdev setup fails Date: Fri, 4 Dec 2026 19:01:34 +0900 Message-ID: <20261204100633.043080942@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: SeungUk Nam [ Upstream commit 56cbd7f69ce6037738410a5c50efb7cacf52b0ae ] idxd_wq_add_cdev() allocates a minor number from cdev_ctx->minor_ida for the new struct idxd_cdev. When dev_set_name() or cdev_device_add() fails, the error path calls put_device(), and the release callback idxd_cdev_dev_release() only frees idxd_cdev, so the minor number is never returned to the ida. Leaked numbers accumulate across bind/unbind cycles, up to MINORMASK, for as long as the module stays loaded. Free the minor number before put_device() drops the last reference on that path. Fixes: c311f5e92484 ("dmaengine: idxd: Fix freeing the allocated ida too late") Signed-off-by: SeungUk Nam Reviewed-by: Frank Li Link: https://patch.msgid.link/20260910074832.15729-1-tmddnr49449@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/idxd/cdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c index 37addcdc10bc2..4c7de92a12823 100644 --- a/drivers/dma/idxd/cdev.c +++ b/drivers/dma/idxd/cdev.c @@ -573,6 +573,7 @@ int idxd_wq_add_cdev(struct idxd_wq *wq) return 0; err: + ida_free(&cdev_ctx->minor_ida, minor); put_device(dev); wq->idxd_cdev = NULL; return rc; -- 2.53.0