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 AB806280A3B; Wed, 4 Feb 2026 14:44:37 +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=1770216277; cv=none; b=mhf13mP8XapmnKKVs/hTkRscEK0EQtWWfYSLVeE6v9gS+4TjzCDJ6GPSRbPRs0loxL7wjTkdQZnxXN71UzdpZcn95GgRi7IKua7qJipOCyJDCSqDjOcWaUfqUtm07zzjVb0onLyQOHDc5gcXWfIcxe+nI5+lboVnRXKdGUN7sCY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770216277; c=relaxed/simple; bh=dOjpwnoSysd8fophgHFoLbRBYVSqfonFn/P2i7cR2Jw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OyV3b4nvpH5Q2v58XVAcGTaLA6+j1z7/0XxqdNIuQqyoXXg776tZRUa/jjKUVtd4cd2nnmoXGXALTGUfnB1niljEpvkegH92Q+vx0VBUWLsHayr9Afvieuf2N3E5gnD3eT09KnMa7Bo2M2zHUJH5IehgIMTuONxzg+DysEMhnxE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pJXPHAcE; 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="pJXPHAcE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7A9FC4CEF7; Wed, 4 Feb 2026 14:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770216277; bh=dOjpwnoSysd8fophgHFoLbRBYVSqfonFn/P2i7cR2Jw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pJXPHAcEL4gA/9/vm0CHl3UctBDqGewpL+fSNTx0G39PbJG7uggdN3ZWnvQ0frgsH +SpgRseBzVCpWv7o7m8t2WAOjF3YtXlsilGpnvooIdBFoZhlmcJlZjRFjDZ7IJjj3p m51CucJePsJg6LGdJd51pVad2PF15EMPzdFFWZPw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Peter Ujfalusi , Johan Hovold , Vinod Koul Subject: [PATCH 5.10 041/161] dmaengine: ti: dma-crossbar: fix device leak on am335x route allocation Date: Wed, 4 Feb 2026 15:38:24 +0100 Message-ID: <20260204143853.242201242@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143851.755002596@linuxfoundation.org> References: <20260204143851.755002596@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 4fc17b1c6d2e04ad13fd6c21cfbac68043ec03f9 upstream. Make sure to drop the reference taken when looking up the crossbar platform device during am335x route allocation. Fixes: 42dbdcc6bf96 ("dmaengine: ti-dma-crossbar: Add support for crossbar on AM33xx/AM43xx") Cc: stable@vger.kernel.org # 4.4 Cc: Peter Ujfalusi Signed-off-by: Johan Hovold Link: https://patch.msgid.link/20251117161258.10679-15-johan@kernel.org Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/ti/dma-crossbar.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) --- a/drivers/dma/ti/dma-crossbar.c +++ b/drivers/dma/ti/dma-crossbar.c @@ -78,34 +78,35 @@ static void *ti_am335x_xbar_route_alloca { struct platform_device *pdev = of_find_device_by_node(ofdma->of_node); struct ti_am335x_xbar_data *xbar = platform_get_drvdata(pdev); - struct ti_am335x_xbar_map *map; + struct ti_am335x_xbar_map *map = ERR_PTR(-EINVAL); if (dma_spec->args_count != 3) - return ERR_PTR(-EINVAL); + goto out_put_pdev; if (dma_spec->args[2] >= xbar->xbar_events) { dev_err(&pdev->dev, "Invalid XBAR event number: %d\n", dma_spec->args[2]); - return ERR_PTR(-EINVAL); + goto out_put_pdev; } if (dma_spec->args[0] >= xbar->dma_requests) { dev_err(&pdev->dev, "Invalid DMA request line number: %d\n", dma_spec->args[0]); - return ERR_PTR(-EINVAL); + goto out_put_pdev; } /* The of_node_put() will be done in the core for the node */ dma_spec->np = of_parse_phandle(ofdma->of_node, "dma-masters", 0); if (!dma_spec->np) { dev_err(&pdev->dev, "Can't get DMA master\n"); - return ERR_PTR(-EINVAL); + goto out_put_pdev; } map = kzalloc(sizeof(*map), GFP_KERNEL); if (!map) { of_node_put(dma_spec->np); - return ERR_PTR(-ENOMEM); + map = ERR_PTR(-ENOMEM); + goto out_put_pdev; } map->dma_line = (u16)dma_spec->args[0]; @@ -119,6 +120,9 @@ static void *ti_am335x_xbar_route_alloca ti_am335x_xbar_write(xbar->iomem, map->dma_line, map->mux_val); +out_put_pdev: + put_device(&pdev->dev); + return map; }