Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2062994rbb; Tue, 27 Feb 2024 09:26:26 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUDn5M1AI0lLgJgi5c+hh/8+YvRJMeFjICAkctWTuMpz8W6YS9zwuvmNlTd2U2URw+AMf0Z8zAUawnzRGkQq28Qo1Q8TrR2Kr89skqQBw== X-Google-Smtp-Source: AGHT+IHk4S7hqfSkmJQsIyIr9MLtno3p1SMHcUVGaOsPPQqDQiNqvaNlt2LuQQu4MLUeoYccM5s5 X-Received: by 2002:a17:90a:9906:b0:299:4269:b8c9 with SMTP id b6-20020a17090a990600b002994269b8c9mr8492340pjp.26.1709054785825; Tue, 27 Feb 2024 09:26:25 -0800 (PST) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x3-20020a17090a6b4300b0029a76b624f4si5808816pjl.77.2024.02.27.09.26.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 09:26:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83706-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Dbu9JDr8; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-83706-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83706-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6E3D9289D31 for ; Tue, 27 Feb 2024 17:26:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D7B9014EFFD; Tue, 27 Feb 2024 17:22:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Dbu9JDr8" Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2055.outbound.protection.outlook.com [40.107.6.55]) (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 0768614EFF3; Tue, 27 Feb 2024 17:22:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.6.55 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709054544; cv=fail; b=X1CR/gIFPeg6uSpib/p9P+bHJ0ZrndI9FPRmGH8p8UT9n2jDX7wpigO0vSbNW+OVcji2ldOShNIGdB6oR9fgEWcaJD8HPlJdWyryPIYDdBKPaEVN7dq/uqNkC6VAnKUt92X7OE2iYwc7lhZAIr9QIbHiEh5Z4nBb7S6xvFuyTqo= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709054544; c=relaxed/simple; bh=Cba1I8lPfT7XGGJBLhHLImkgVygTholVVk8WsvGvZuQ=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=H25vVGD+Od9kZWAysdo7uZ3xbCvpdD9i2Mqu9iiyVL3x8Guonr1w5z9ZS9UjAxhjW699VS6MIUaxqtWwB3puzC3JzKFjfJpZk25e5bGNLAIp2GbWa8VUYm1oOZZqqyChWit6e459kvv1Ln9kXH16DaKea7pe2h5Pg5m7kjSxVB4= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=Dbu9JDr8; arc=fail smtp.client-ip=40.107.6.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iJaa8YzY0yU/dLMtoM5SU6YrO8j0TqJQNjuxv3ZzcCXLzymnXtXWLz3feHoJOwHVjwW4uXQx+T7zBTGpb1qev4vSB0nxMkShDph6yYJWl8QGrN6jX+m+vXiSW9rGI6Jzks+eGUbEG3a0FWrZ8zRzW12n/YsfS6hoVvk4vA+QyNPTyebaObUjry+ChaYu/qT6+8dvVe/FpBk537alq8n4NgyLUK6WxdyOL56D/tv17flFt0BJ5YXNZlE1RqH9XCiV7Gx0fu9C8x9wIeXJK+wUG7fRW62oO/cXTTbTZE++urXX0dfvltWiBKAbP6R85qiVcLE4Myf33f2hIy6iu/5p7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=OLs/58IIUeveyfmtV9PhDz6tUG0OWzPy+/o3nZ1cyIY=; b=Ba3nrCNQTUMpCdcF5RETFLCRC2l8XsApsgf28lA0jf8fVEB+o2KKPZolAaWHOwi6dy3ewj5EctFh6aQwAcmRNvL1htj5Gse82nMqShBvylwko+t1jZXuSt0BzQTFPFFSw8cn0fPGXvM+k0oNTh7rLrvIJGjgKEKnQxzF/XoQZPw0FGABPMcHQr0LEi+gz2OY47dSk1QKHGgw3mgmqm+VpKOcrfkymvPUcMwV2xGb8LumPwdtyVJjfK+xMjnFITmA27ZjK1Woo5MsCFMkLaFlEytFN2uQ1SAmGpu2X/OfTIwlWrX7i394TcjR5L345iKUO3bxTSTuTKJYzn6El3yeaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OLs/58IIUeveyfmtV9PhDz6tUG0OWzPy+/o3nZ1cyIY=; b=Dbu9JDr8Hq28cT4y2zahOCHQ+K1ISKnbe6WgvqRnT7SMdRASbjbrCA9KS0mGKriBHzzhO++NrBSoylo/4vQtNv4LO2W3z/LIrJd6w+qWVrVptVBPQeODFrbNWIAVrTS9peXzG1eVVueQsqC7uf9p/8KGP16hYJUMkoIcDy3kawU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by AS1PR04MB9408.eurprd04.prod.outlook.com (2603:10a6:20b:4d8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Tue, 27 Feb 2024 17:22:18 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9af4:87e:d74:94aa%7]) with mapi id 15.20.7316.035; Tue, 27 Feb 2024 17:22:17 +0000 From: Frank Li Date: Tue, 27 Feb 2024 12:21:54 -0500 Subject: [PATCH 2/5] dmaengine: fsl-edma: add safety check for 'srcid' Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240227-8ulp_edma-v1-2-7fcfe1e265c2@nxp.com> References: <20240227-8ulp_edma-v1-0-7fcfe1e265c2@nxp.com> In-Reply-To: <20240227-8ulp_edma-v1-0-7fcfe1e265c2@nxp.com> To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Peng Fan Cc: imx@lists.linux.dev, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Frank Li X-Mailer: b4 0.13-dev-c87ef X-Developer-Signature: v=1; a=ed25519-sha256; t=1709054529; l=901; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=Cba1I8lPfT7XGGJBLhHLImkgVygTholVVk8WsvGvZuQ=; b=BmFxSUdl/KUEZPYVMBtSkXMGE4o+yIg7DElAlG9Dvn9iZqgL3PJGsxSGm261NMigMG0Okfx+G QlPjEYBJy9VCZEOZCSLJNjSt/ReeFaw+ZHaJrFeGRE+VHkbLa1A1x02 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0059.namprd13.prod.outlook.com (2603:10b6:a03:2c2::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS1PR04MB9408:EE_ X-MS-Office365-Filtering-Correlation-Id: 18ecc72e-7ce6-428a-7423-08dc37b8a5d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XarjfkF6ztdFwprXzf4yUFLF7cPwZeBSVLCX3XnhCcFcG/9DaoZqVoSBbL7Cjs6+s6jaAQnvqDXNoVO07gLMRKgZNrB+PlZuRC/IJoUzg4I7x23JYcdQmO3OScD0r7RkjKWqso2wgJq0aWH8/ZtBVIHybH9bDD2pok+ET9y/IASJAiG9Hs2qc+h1xg6NR6x3jxTa6/AH3QzIIKC/R8paQ3AmwLbTUftNWQQABsylv78pKPo3AmU4WlVZykDvcDKx82J1obHW9gUxbBKJdpbeMaGA9PGYRF3SWeBc0iQDUDMnMi1qbL/67qQJKSmMVTZVLUehj1gHr66l/Vi0OTE2EG/C2D5A3RBhYQwTyrTgzJs/lJGkG95uTj443/dSb5wVIPfjqUr9vxAYJlCq1zy9qq989AfH8uhMfd7tYsKqqT20N39xffCrUXVs3uCvhyT7KSPK/SsR00qtNYvCPMMDdMZEVrq7tCv6ngeaM1zd86Fu1JmdbjkPcYIbNu/9Y51XGcd0Gga2V/G2kZD1MbIb67TuyqDpjr+8rhc+UD124s6O0ohPbeiFm9beNlxjx8hci3HQMMGTLFMRrvhDa71nBqk7P8pmrz4AQ8IL5EAdAnJSO0NDtG+mB452CruFQ0UB96GXcItIyHPE5K0V33sKYComAUR0KRniRP0C+pXvA8aEHV8CBFgvzxE3qqhlJfYA82IrVthJRAyIC9jt9V2bMPiyRM1+ria2FMmD9DnNaIo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YWxqL1h6VHluTDJndG85NkNZOHE3aG1sdmQ1Z0JHU0puRGYzVHljM0ZWdlZT?= =?utf-8?B?T3NsVjdISGM2MFE5Ly9xNDdKMkVFdUdWdTBGYmJ0RjBrZGxSY0JKOERoQ01T?= =?utf-8?B?MkpGWTFSSnpWdjhZMFgvRDNLbTA1V0VDMi96aUJtKzJlODBncEN3T3hTV2RF?= =?utf-8?B?dDFHOG5nT3JOcHFva1BkdDZIaFc2QU5wS0RnYWhjOGpTeUpNV2hXMFZtUmZF?= =?utf-8?B?Nk9zb0V3ODhMdUxCUmk0OUt0VFpUV2JPZHhv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hX?= =?utf-8?B?UXJ0eThwakpZbk01VW1PZjROdXVIc1F4ZWlpOFlpSGhNRlhrdUNpaXpDTVJU?= =?utf-8?Q?WhNImIni60WS73eWlyIlrd4gM?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 18ecc72e-7ce6-428a-7423-08dc37b8a5d0 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2024 17:22:17.6074 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6w1LFTRIkZ+ZXYp58HsAkcKsVTraj6Z2nS7WKim559ZQ0SeOMfRYdtqXq9wlzKmzIZ64giZy0yiYwra3gux2lw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9408 Ensure that 'srcid' is a non-zero value to avoid dtb passing invalid 'srcid' to the driver. Signed-off-by: Frank Li --- drivers/dma/fsl-edma-main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c index 0a6e0c4040274..2148a7f1ae843 100644 --- a/drivers/dma/fsl-edma-main.c +++ b/drivers/dma/fsl-edma-main.c @@ -115,6 +115,13 @@ static struct dma_chan *fsl_edma_xlate(struct of_phandle_args *dma_spec, chan->device->privatecnt++; fsl_chan = to_fsl_edma_chan(chan); fsl_chan->srcid = dma_spec->args[1]; + + if (!fsl_chan->srcid) { + dev_err(&fsl_chan->pdev->dev, "Invalidate srcid %d\n", + fsl_chan->srcid); + return NULL; + } + fsl_edma_chan_mux(fsl_chan, fsl_chan->srcid, true); mutex_unlock(&fsl_edma->fsl_edma_mutex); -- 2.34.1