| Message ID | 20260709135846.97972-22-panchuang@vivo.com (mailing list archive) |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-sunxi+bounces-24296-sunxi=pue.re@lists.linux.dev> X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mxe881.netcup.net (Postfix) with ESMTPS id B46F11C2B3F for <noreply@patchwork.local>; Thu, 9 Jul 2026 16:19:50 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=vivo.com; spf=pass (sender IP is 172.232.135.74) smtp.mailfrom=linux-sunxi+bounces-24296-noreply=patchwork.local@lists.linux.dev smtp.helo=sto.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.232.135.74 as permitted sender) client-ip=172.232.135.74; envelope-from=linux-sunxi+bounces-24296-noreply=patchwork.local@lists.linux.dev; helo=sto.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sto.lore.kernel.org (Postfix) with ESMTP id 562723067092 for <noreply@patchwork.local>; Thu, 9 Jul 2026 14:04:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 24A3343710D; Thu, 9 Jul 2026 13:59:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="He0v9Xw7" X-Original-To: linux-sunxi@lists.linux.dev Received: from TYDPR03CU002.outbound.protection.outlook.com (mail-japaneastazon11013001.outbound.protection.outlook.com [52.101.127.1]) (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 AAF48437126 for <linux-sunxi@lists.linux.dev>; Thu, 9 Jul 2026 13:59:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.127.1 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783605590; cv=fail; b=qHPGsX0eo66xHuOWXr3o9sx7oJN69FjqN22W37mJXaGXNJvG1+8TxXPuOBcEWAzxKugJUCg4r1/OoNF0skcA64ebjxK9i5OlEWBE183r79+uULnrjTm7VDkAZ5lh0ZecWeb7I0+mx4Bd2V1QifmlfTP5s0WBzEFXAIXpsn7iebQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783605590; c=relaxed/simple; bh=cPpa68445J/XMxW4BMpQJND9vD5VuIEDxonVHRckdio=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Yrucg27oqsR2s39Rm1z2aHIM1y14PiV9wvPd/lc5FaMH4IZCHaU+895nHvQ4Y+aOHme8/UeNaK2a9Uw6SCapHzqJzT4J2W9jfvRks9xp4zRWigliIcsIV2nmW7uAhhdAPW75eoOlzVSgm8cbmfohhy5d0aFh1jRlF2AjUGwD81A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=He0v9Xw7; arc=fail smtp.client-ip=52.101.127.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ix2wUBwIS+UXa0ccJZNVGgeX/lYqA6Aa8VC9+OZCG0nVkLIu6wwA6Do1YxEmY91xUQNMfv/YyUSCj3Dx3ETSOwP+nt1yOflxOTVL4ol9RgZT8HCFay/RJjwLTRKaRkhqAkl+amyw8/IFFpxym8i7r3i04zLrNnMUtWkBsofS3IrJFufr6Noxr5btTrZiDg4ATjv5X17dwEgzt3tmxqY7u5xc25q5Y/CGY16MaHzz4T5xKf16iZWrRng/2kmSHOL4YK72BN0r/NPLqtL/2X2Ax9M/aU58SdsGFa9a+K9tT8al208tdltTV+YDfmK2qmmKCjJRSLwwWTx9wwFpd9e/Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rEv+eGpOr9G9Z1/z4b89EdAa3gHWDW9PHgDZOmGZMvk=; b=gBSB9SiP/Z80S7i1gaWbQT6uub7m/AcQBxK7MLOt5MFXY1r781Ie2cqQP2tRSrT/8QGjv+Ki9J/gHI6WdTvsY4z06+w7DnR1myoTyCimTWWzo061WBR1H5IN+F00PajMLtwuLpuMb7XgrQIoOTeo+VwZJLuhsv/Ibq/ypx5HotKdxGMEvr8kKmKQ+bQ6Pfe7Us8Htz+CcxEeaqlaQqYMrrNTp4l1xjAG31WbvN4EoRKN6+2TTLIdSUGDvjdDg2LmcCICsuA60s9YRXbiTdfTyvG8xsdCQFwl3/jO82o4z+7uuQIW9XBFEKc51aawHyp3HdmyjJ/Gny0as+gAOlUwZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rEv+eGpOr9G9Z1/z4b89EdAa3gHWDW9PHgDZOmGZMvk=; b=He0v9Xw7uprgzsdJRpg3qSis7wSKxS22wXSbgXDARmrMrpyQ5amQMkuI+1976YZ9m4vo+ym8n3Ub8CHttp1DGA7pom1xB74LJiJz9WcMFfvFdizBFIPCcSKL1hfBylnfQ01AzslLkKwX+Eb2AYW3MGpPmGAKLZUypp9meEW2AcmwhrDgFqRpbwoKE0vKd2jT4NoYCpV2mmRodogYYs7gk7u9gTnih4xtaZkaf+klrgSUyZRowkgvWB4rOuHWwQO9TspLHcjzlzS+DzUulspqvLx7QKJVP7TE56ginm7tPODZj0ymsa0mi9zn77tZNdLfWuB26fDj6t2CPeoZnLv7SA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5832.apcprd06.prod.outlook.com (2603:1096:101:c8::12) by SE2PPF271E4F3E3.apcprd06.prod.outlook.com (2603:1096:108:1::7c8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.181.9; Thu, 9 Jul 2026 13:59:45 +0000 Received: from SEZPR06MB5832.apcprd06.prod.outlook.com ([fe80::f98:5e32:4ccb:d07b]) by SEZPR06MB5832.apcprd06.prod.outlook.com ([fe80::f98:5e32:4ccb:d07b%6]) with mapi id 15.21.0181.014; Thu, 9 Jul 2026 13:59:45 +0000 From: Pan Chuang <panchuang@vivo.com> To: Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>, Chen-Yu Tsai <wens@kernel.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org>, dmaengine@vger.kernel.org (open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Allwinner sunXi SoC support), linux-sunxi@lists.linux.dev (open list:ARM/Allwinner sunXi SoC support), linux-kernel@vger.kernel.org (open list) Cc: Pan Chuang <panchuang@vivo.com> Subject: [PATCH 21/26] dmaengine: sun4i-dma: Remove redundant dev_err()/dev_err_probe() Date: Thu, 9 Jul 2026 21:58:25 +0800 Message-Id: <20260709135846.97972-22-panchuang@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260709135846.97972-1-panchuang@vivo.com> References: <20260709135846.97972-1-panchuang@vivo.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: TYCP301CA0073.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7d::11) To SEZPR06MB5832.apcprd06.prod.outlook.com (2603:1096:101:c8::12) Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: <linux-sunxi.lists.linux.dev> List-Subscribe: <mailto:linux-sunxi+subscribe@lists.linux.dev> List-Unsubscribe: <mailto:linux-sunxi+unsubscribe@lists.linux.dev> MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5832:EE_|SE2PPF271E4F3E3:EE_ X-MS-Office365-Filtering-Correlation-Id: 76688458-0151-4b17-a639-08deddc254b8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024|23010399003|52116014|38350700014|18002099003|11063799006|56012099006|22082099003; X-Microsoft-Antispam-Message-Info: u5KlUFnN3bNFuzFput8fIFNgpVUi6U9Q+VqKg3IxLz9Fq05WmoH8V48cWvc/22KWSYFLQ59eqbrRLnGHx1OJ54Gpc+EkIDYzkkX6qK7YINFe2S+YPHZg5UXuYGRxf8/2avTJ+zFhX29r8lV9qD7ejH4cqFFY6r+BHKFwBWyt/r06RnLfsQsNyd1B3gWFQfBeXoQ7XRJTQcPbxDHZpQ3IAgt0NP9MwoxoE19KOlG/6cLux0oyJ4FMX+ixU+a/J9jEoDEFYfq3Xvg3gNqZJAY1AxGv2U/06YviHU6pWo4I2v+EeL14coH7jBKqUghxeE+yrdPmYK1J/UgmlF4PJizk5Ry/lISfVTBhxu5tb06wRbG78PXr+MpMsH7VYLKyHw0JANfpr9iAadfOxAINxPxU3XcXr+oJqsVnHdV99F8v530ghTQSiHRFv760yH4RhhKGhxQjA0KtfZMI6SxIM/QUx4Gxj++elb8cQIa7UJuRNXWq9OVasJY/mhq7o5t2x+VMp8cDhXK/BNmp2QW0BaZE7Sks8Z1yh28Xx9ZTb5fuRkCNIdUdwNE7AkbhDv5ZK1FaCrUyHbhxQa52RsgTMrfqEL9njyMhOtpvw762avtERxTZmSj1Gi6/ED8zmAMZUBP6Q934OAh2fGKgKxSVeNJu2PHSY2muJo9e1hRjLKVVmYUjn7Mli996u6ThOiXEmHfaIJYDDKnZumCCoCg3IujWpix7yaXtsoi5n3h6uyuclmA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5832.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(366016)(1800799024)(23010399003)(52116014)(38350700014)(18002099003)(11063799006)(56012099006)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iFa/yuuRqM024gg4BeAsvp4l4wDCaTBSdR5ERaSh0JtYsr4LYopt4YUhO/ygRfV5Y9Wqti++pDpu6lteIw4PzzbjGaON3KK+E/xLKm5X56NSv2npWmqowt0b173FVsko5MEKm7NL13angHZVXr5J2N0uWAR3Q6mzVvaaT7ZNYsL5nOEvRR7Vqsrg+NNAwGAVi7eVjqgY7E9FQ1iwM7lUnm8s6/G4/3QDYxml4iCcaGnfBoNZQPDNAHLfW/XLeO7+qaSSzklSCnKcIEOkX/wLtHHeion4tvV1ubrKlumZn17zyjwjdCjdDGy3ZbI8z0qTOAp8sSF+I5gLURAOmMEMx6usq3auqb6W40zh2ZR5SDOWrHWDEyXGn8tCWgbAs5yqE1CMBKYvpjx7y4brZ5o5JK9PvFPZ8s65/WkU0ERyO5IW5ODtIWp3SqN+0U3LWklAThH0rKcFgJtUHt6Pi9F8r2dQCP6erXW+rojyTrnIq+5gLtmGQBnPl7FIdFCPQhbUYlnES3oQQBhdNMPdpvHqYfLF6orcZhzt3nWiwrETHTczZzHL9ochrL0lYU0zXvy0tCLQZgryuwtTibr2bxgyuzLyGq9Ch7GeF1B1lBHMXLqhDGSphFoB5AIEcFLFGIeA5jkBYO3A20Dqyb3zUUC2Pr0L5pA2cGvUo13trC/k05SUp5py5szwzALbGI2vbp0CRoFZ3nQKbC8MUhiug5D7V+mbEAeix8Ws2QyLMmECG/fPEj+9hVtnTr8e8xuTguwPqfQFPQZAA/g5l+00++T+g5GsbYHGpvEyXIrcgE6zM5xRnMUhtyGfdX4gntauQ3hx0m44z4FgbWVgTZJteKAxD2YEWDbJ/oqwMMZif7PDgWrq5vwVf2VoZ1GDYQ4Wqm4X9CxuBCQQdsyQNizAGhikgkYOfEZZhvHo522zq1g07Dl8loinOBYWNeGSWt2uT//Ga4v/7MslHW/7wg9z2xX526YYxJ59svmR5Bqcp5O5MdXLXKu0FAGX6gM6wd+NuJliOXPk5o0xoVQsesR7RyXCZPTPMgpXUK5+WY23TQHgVk7vCI0wJLHdUWcdqiYJBO9i1OuRU0xa27HAa/Gc0AHryducN0GfoG+dV4AzQ51nWNTZ1sxnLiqKaMTXlZnugKKxqJeCUeD/8YPbo9nZ54Cwgo3h1lTq4Fb2SbrNZ/aDFJDmtUrf4V3L0cOLMSY+oA07RqzdBHG6m/YdwoE9epnRcY0J3F6QLdSx2tiOmq6BrWz/i5/nEkV8MgChoqzgDQoJ71yPFWOBiRimFsZDNK78SnUIBK8xWEREJqeA5JKPguDbwjvmvDsTGzTkqPCjJT8vd7rZeyDJFMoIR0Y6HE3MuqcmqIhRkgmg+pvJd/9bZat2iodBQT4TqJeqGmcysHcHwjVKp6J1oLf+ftVIU00yQYXQlpp4cDSyOIY001+9yqx5xU+sJqm01thGgl9LBfJHSvwmlHwhyFtID8D959qUEfWRHV9eXOrKNWb/+Ib0hhVuoan1BFx4zx4+fgv434vXboF8xKVBD++r/vk0M59RX1znU64xAsnxCBrvIW8FgkXyaL5iQICJ3Un/I4p7FjDfFwiLBtdMYK3bL8ijOafLQj4bGCYJzHG86HL6Blwi4XFD9FuZkS3ndz9bIFavnBjOC4oZQmBLijPgNfQ+2OdZGI4aGtmxbpIYyWjoPhaObMXGvvTzoEDnim0Esa5JjyIObutipbMiaL/q4hcVXbkPsA== X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76688458-0151-4b17-a639-08deddc254b8 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5832.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2026 13:59:44.9589 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: d/o2SGs8m2SZu2EKmoFRy4Ox4kQH4eYQiq73meVyaW8bNu8SyI71fUwszQHlYXSC8vpwSMou+gVn7+HspA4ugg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SE2PPF271E4F3E3 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [0.34 / 15.00]; BAYES_HAM(-5.50)[100.00%]; RBL_SENDERSCORE(2.00)[172.232.135.74:from]; SUSPICIOUS_RECIPS(1.50)[]; ARC_REJECT(1.00)[cv is fail on i=2]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; MAILLIST(-0.15)[generic]; MIME_GOOD(-0.10)[text/plain]; BAD_REP_POLICIES(0.10)[]; HAS_LIST_UNSUB(-0.01)[]; PRECEDENCE_BULK(0.00)[]; TAGGED_RCPT(0.00)[]; FROM_HAS_DN(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[sto.lore.kernel.org:rdns,sto.lore.kernel.org:helo,vivo.com:email,vivo.com:dkim]; RCVD_COUNT_FIVE(0.00)[6]; FROM_NEQ_ENVFROM(0.00)[panchuang@vivo.com,linux-sunxi@lists.linux.dev]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_ALLOW(0.00)[vivo.com,quarantine]; RCPT_COUNT_SEVEN(0.00)[10]; DKIM_TRACE(0.00)[vivo.com:+]; R_SPF_ALLOW(0.00)[+ip4:172.232.135.74]; R_DKIM_ALLOW(0.00)[vivo.com:s=selector2]; FREEMAIL_TO(0.00)[kernel.org,gmail.com,sholland.org,vger.kernel.org,lists.infradead.org,lists.linux.dev]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[bounces-24296-noreply=patchwork.local]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; ASN(0.00)[asn:63949, ipnet:172.232.128.0/19, country:SG]; RCVD_TLS_LAST(0.00)[]; TO_DN_SOME(0.00)[] X-Rspamd-Queue-Id: B46F11C2B3F X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= |
| Series |
dmaengine: Remove redundant error messages on IRQ request failure
|
|
Commit Message
Pan Chuang
July 9, 2026, 1:58 p.m. UTC
The devm_request_irq() now automatically logs detailed error messages on
failure. This eliminates the need for driver-specific dev_err() and
dev_err_probe() calls that previously printed generic messages.
Signed-off-by: Pan Chuang <panchuang@vivo.com>
---
drivers/dma/sun4i-dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider: Pre-existing issues: - [High] Missing tasklet_kill() for virtual DMA channels in device teardown (remove and probe error paths) leads to Use-After-Free. - [High] Ongoing DMA hardware transfers are not gracefully stopped in sun4i_dma_remove() before clock disable. - [High] Race condition between sun4i_dma_interrupt() and sun4i_dma_terminate_all() leads to NULL pointer dereference and Use-After-Free. - [Medium] Incorrect DMA residue calculation in sun4i_dma_tx_status() for queued (unstarted) contracts. - [Low] sun4i_dma_of_xlate() strictly validates against hardcoded max DRQ type limits rather than the SoC-specific config. -- --- Patch [21]: [PATCH 21/26] dmaengine: sun4i-dma: Remove redundant dev_err()/dev_err_probe() --- commit 0e16200d5dd839cadb8ffc88ed67f75051cff988 Author: Pan Chuang <panchuang@vivo.com> dmaengine: sun4i-dma: Remove redundant dev_err()/dev_err_probe() The devm_request_irq() now automatically logs detailed error messages on failure. This eliminates the need for driver-specific dev_err() and dev_err_probe() calls that previously printed generic messages. > diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c > index d2321f7287d20..303d71ba0ab61 100644 > --- a/drivers/dma/sun4i-dma.c > +++ b/drivers/dma/sun4i-dma.c > @@ -1337,7 +1337,7 @@ static int sun4i_dma_probe(struct platform_device *pdev) > ret = devm_request_irq(&pdev->dev, priv->irq, sun4i_dma_interrupt, > 0, dev_name(&pdev->dev), priv); > if (ret) > - return dev_err_probe(&pdev->dev, ret, "Cannot request IRQ\n"); > + return ret; > > ret = dmaenginem_async_device_register(&priv->slave); > if (ret) [Severity: High] This is a pre-existing issue, but does driver unbind safely tear down the virtual channels? drivers/dma/sun4i-dma.c:sun4i_dma_remove() { struct sun4i_dma_dev *priv = platform_get_drvdata(pdev); /* Disable IRQ so no more work is scheduled */ disable_irq(priv->irq); of_dma_controller_free(pdev->dev.of_node); } If the driver is unbound while an interrupt has scheduled a tasklet, dma_async_device_unregister() called by devres will free the DMA channels and the associated priv->vchans memory. Since there is no tasklet_kill(&vchan->vc.task) call to cancel pending tasklets, could the scheduled tasklet execute after the memory is freed and cause a use-after-free? [Severity: High] This is another pre-existing issue in the same function, but does this safely stop active DMA transfers? drivers/dma/sun4i-dma.c:sun4i_dma_remove() { struct sun4i_dma_dev *priv = platform_get_drvdata(pdev); /* Disable IRQ so no more work is scheduled */ disable_irq(priv->irq); of_dma_controller_free(pdev->dev.of_node); } If the driver is unbound while a DMA transfer is actively executing, the hardware configuration registers are not cleared to halt the channels. When devres subsequently disables the DMA controller's clock mid-transaction, can this forcefully lock up the AXI/AHB bus or corrupt memory? [Severity: High] This is a pre-existing issue, but is there a race condition between the interrupt handler and channel termination? drivers/dma/sun4i-dma.c:sun4i_dma_interrupt() { ... contract = vchan->contract; /* * Disable the IRQ and free the pchan if it's an end * interrupt (odd bit) */ if (bit & 1) { spin_lock(&vchan->vc.lock); /* * Move the promise into the completed list now that * we're done with it */ list_move_tail(&vchan->processing->list, &contract->completed_demands); ... } The contract pointer is read before acquiring vchan->vc.lock. Concurrently, sun4i_dma_terminate_all() on another CPU could acquire the lock, set vchan->processing to NULL, free the active contract, and release the lock. When sun4i_dma_interrupt() subsequently acquires the lock, it performs a list_move_tail() using vchan->processing->list. Could this cause a guaranteed NULL pointer dereference since vchan->processing would be NULL, as well as a use-after-free when accessing the freed contract structure? [Severity: Medium] This is a pre-existing issue, but does this calculate the residue correctly for queued contracts? drivers/dma/sun4i-dma.c:sun4i_dma_tx_status() { ... promise = list_first_entry_or_null(&contract->demands, struct sun4i_dma_promise, list); if (promise && pchan) { bytes -= promise->len; if (pchan->is_dedicated) bytes += readl(pchan->base + SUN4I_DDMA_BYTE_COUNT_REG); else bytes += readl(pchan->base + SUN4I_NDMA_BYTE_COUNT_REG); } ... } If vchan_find_desc() returns a pending, unstarted contract, and the virtual channel is currently executing a different contract on a physical channel, this code unconditionally assumes the hardware byte count belongs to the queried contract. By subtracting the queried contract's promise length and adding the executing contract's hardware residue, can this return corrupted residue values for queued transfers? [Severity: Low] This is a pre-existing issue, but does the validation correctly restrict endpoints on all SoC variants? drivers/dma/sun4i-dma.c:sun4i_dma_of_xlate() { ... /* Make sure the endpoint looks sane */ if ((is_dedicated && endpoint >= SUN4I_DDMA_DRQ_TYPE_LIMIT) || (!is_dedicated && endpoint >= SUN4I_NDMA_DRQ_TYPE_LIMIT)) return NULL; ... } The validation uses hardcoded limits like SUN4I_DDMA_DRQ_TYPE_LIMIT (32) regardless of the SoC variant. If a device tree requests an endpoint of 20 on a suniv_f1c100s device, which has a limit of 10, would this bypass the check and program out-of-bounds DRQ indices into the hardware?
diff --git a/drivers/dma/sun4i-dma.c b/drivers/dma/sun4i-dma.c index d2321f7287d2..303d71ba0ab6 100644 --- a/drivers/dma/sun4i-dma.c +++ b/drivers/dma/sun4i-dma.c @@ -1337,7 +1337,7 @@ static int sun4i_dma_probe(struct platform_device *pdev) ret = devm_request_irq(&pdev->dev, priv->irq, sun4i_dma_interrupt, 0, dev_name(&pdev->dev), priv); if (ret) - return dev_err_probe(&pdev->dev, ret, "Cannot request IRQ\n"); + return ret; ret = dmaenginem_async_device_register(&priv->slave); if (ret)