From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FE64606A33F for ; Fri, 27 Nov 2026 14:25:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Vyxzt0di; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=gQ9RBAIt; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=qLq/w5HZ DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=UQLxiR4OJKzKy07KHxANW+WFPKdum+b5zKt67PZEcLQ=; b=Vyxzt0dicNK748mMcAFWJgQ9/m CLkEFh6rgpZGyhHe924nfn7WyaepN8kTahiAF4bO2SrBT+9hNoVlQySTEalxE8aQRG0SarRVlBxDm 0WKawRj8H1Z1iXYI5EQqK6oiCjzpBPVSydDVz8PX+/3fOI8ObrQoP8TQJzl5iw865rKeRn/Ug21gk Nzp6qz6uMh1sZPVpU3geJZILAtgjjH7NUrbZJdYDdgXMgd4JGDuIR2X8rmoGwCnP4Mk1889cetHbw 3A5ofEX4cnf71u/HO51F+NbgS/6pT6x2LdhFGm/E2ExSMKRIwg5tt1RGu8XJgqf9/rNW6ycoi0Xl5 qgVfL4dg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWwtd-0000000GQUA-0aoz; Fri, 27 Nov 2026 14:25:53 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWwsf-0000000GOra-09UN; Fri, 27 Nov 2026 14:24:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Sender:Reply-To:Content-ID:Content-Description; bh=M2k46SqZeFAHhImutX8AfiF7k/5VtRokj0DSCN0ndaQ=; b=gQ9RBAItI1yJ2ymwTqDpqXCeCf wtd8KXiFPNqO1LY+h4oswJm6gYJRy5C40zG5WaaxQ5hsD2P49kMx3onaKCE8JJ2g6Go2vmAxRtbO3 492fKRVocZMjI3nnMGHmPOuKAI5ZUcbUloHzZ3rMe5OtX5k3Mte+aFh4fRB4/v5GFieQ9pOvt1NaQ Ck2hWCFyXyk/RunYTtSpxLr8kg497yAmScgXk8Lus94eTSYSu6eRNQdVgrg3rKl9Cg/aeXxwsdSQU XvyX2ijanhKMTBIgUaiZ6Ljf/k3xeg9v2cvI/ZAhpZuMcHYnAojHkRKVus8bf+68QbfU4b+8BS2pE FOJOlK3A==; Received: from smtpout-02.galae.net ([185.246.84.56]) by desiato.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWwsb-00000007mir-0DFU; Fri, 27 Nov 2026 14:24:51 +0000 Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id E466B1A183B; Fri, 27 Nov 2026 14:24:47 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id B61366049C; Fri, 27 Nov 2026 14:24:47 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C17DC11E68FF4; Fri, 27 Nov 2026 15:24:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1795789485; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=M2k46SqZeFAHhImutX8AfiF7k/5VtRokj0DSCN0ndaQ=; b=qLq/w5HZ31eb10uUhvMBpLQ5NKAns3tpw/zvBm1CjdBwKY6wum6rePPCIU6Qx6jQ7XlGJh ZLLUQTX+BUv/bRtoN5wBzgzRON8u75S5IZXVCmDh5lrqqVehTytTe+9hhyeP0jC7R9Az6J ewDDWqzH6IFrt5FH7NpaH4PpzR4qtVuCRgw9EP8b9dpukz12WH4JaYoDIaJmqQ8cOhxffw gN9LpHygIsYKbavexGfIueJdC9XGDsPzwTeqxnzWNML1EMEVTCaV9swLofwZFzS9vmaPcT lKNF1VjGcTLnrExFNasva/MMGOxKlR9jimuKh7muUV0nQ3ii7KEL2FVlwf97xQ== From: Miquel Raynal Date: Fri, 27 Nov 2026 15:22:33 +0100 Subject: [PATCH RFC v2 11/35] spi: atmel-quadspi: Reject excessive dummy cycle counts X-Archived-By: MIME-Version: 1.0 Message-Id: <20261127-macronix-upstreaming-spi-mem-cycles-v2-11-5c93f5e5d630@bootlin.com> References: <20261127-macronix-upstreaming-spi-mem-cycles-v2-0-5c93f5e5d630@bootlin.com> In-Reply-To: <20261127-macronix-upstreaming-spi-mem-cycles-v2-0-5c93f5e5d630@bootlin.com> To: Mark Brown , Liang Yang , Feng Chen , Xianwei Zhao , Han Xu , Conor Dooley , Valentina Fernandez , Daire McNamara , Haibo Chen , Jyan Chou , Yu-Chun Lin , Maxime Coquelin , Alexandre Torgue , Pratyush Yadav , Michael Walle , Takahiro Kuwano , Richard Weinberger , Vignesh Raghavendra , Tudor Ambarus , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Matthias Brugger , AngeloGioacchino Del Regno , Yogesh Gaur , Chris Packham , =?utf-8?q?Jonathan_Neusch=C3=A4fer?= , Michal Simek Cc: Thomas Petazzoni , Alvin Zhou , Cheng Ming Lin , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, imx@lists.linux.dev, linux-riscv@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-mtd@lists.infradead.org, linux-trace-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, openbmc@lists.ozlabs.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261127_142449_144377_E39DD60F X-CRM114-Status: GOOD ( 10.13 ) X-Spam-Score: -0.2 (/) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 The controller stores the number of dummy cycles in a 5-bit field. Programming more cycles would silently truncate the value and corrupt the transfer. Add an extra ->supports_op() check for that. Signed-off-by: Miquel Raynal --- drivers/spi/atmel-quadspi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index abca99b32b61..8946abaafa81 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -487,9 +487,15 @@ static bool atmel_qspi_supports_op(struct spi_mem *mem, if (!spi_mem_default_supports_op(mem, op)) return false; + if (op->dummy.ncycles && op->dummy.buswidth != op->addr.buswidth) + return false; + if (!op->addr.dtr && op->data.dtr) return false; + if (op->dummy.ncycles > FIELD_MAX(QSPI_IFR_NBDUM_MASK)) + return false; + if (aq->caps->octal) { if (atmel_qspi_sama7g5_find_mode(op) < 0) return false; -- 2.56.0 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic