Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3640594pxy; Tue, 4 May 2021 06:54:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSyQuksJ7mPbiC325QWhDl48n/dY3QF9nYuWS7UhU99ChwoOCCd3eJqCbNfR/q9Fp5Ab25 X-Received: by 2002:a17:902:d645:b029:ed:5c25:9ac0 with SMTP id y5-20020a170902d645b02900ed5c259ac0mr26334335plh.23.1620136493086; Tue, 04 May 2021 06:54:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620136493; cv=none; d=google.com; s=arc-20160816; b=yMvab917DATLdVE2hF+m0Ds7XL24G7Jw7BouMoMuF57n0ZbNkKql/hLiEbN6thk/VU XFAa8c48wtGPOl6m4Ra5+G+qwBi+cvfc/ls4tFQAVffYV5mxJvAuFsPe0JUgIH6Racby cLQJpZ+1rQv+PMAlSuHzIlYT84GzJoEX1kHzCY6HaCpzxFfF/HhB7pnnQtEdWb3V2qAR TePggMX/Hm1xpFl6XPb6E2GJj9Z8lavn1UrffALYwrYmNeHRoqeC7G57XjI7Hr56qL1O 3yMjUcjur1d1Knw0U18CdqprDA5eSJdXRTJloppw6bQNjUyPnWrBNknLb0rTsp/u3Vjl dxvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=GtrbHtBZaTxCXIUNx7bEcgzDDCvXxl5MP5is4U9Hbeo=; b=coVK3bnGBpeHA2mhUuYELSVCfKzskL49UfUdRVZ66G6daWUnS/zSwIdwEd/Z74J+Tx 3i+7elwj2l3dHA1N5GrVQ6Yh9u2HZy2NUDweb6EBu2UigmCMBjxJOF7V4KBPUcxX/Hbx hUvStdvq+d4axUsU3sPSLpQh8WBd0A/3aQmxUHsPfJs6MYEz2I2j8sywrcQ7eb8Ah/bD xBa9KqdXy9IclXlVG1rSHDR1EZ+8C/Mgu54t2oAWzbCgRW2KQFNdXzgGrP45K3Rnclwz X4MyBtAMyjOlzSUsplxhbjhb6xdufWc6jooJmKpBODCFSFASsDJwdzfOgpN8f0xn7o9n qk5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v6si3381702pju.127.2021.05.04.06.54.38; Tue, 04 May 2021 06:54:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231302AbhEDNyw (ORCPT + 99 others); Tue, 4 May 2021 09:54:52 -0400 Received: from bmailout1.hostsharing.net ([83.223.95.100]:42073 "EHLO bmailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231216AbhEDNyu (ORCPT ); Tue, 4 May 2021 09:54:50 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id B0749300002D5; Tue, 4 May 2021 15:53:53 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id A367F437A5; Tue, 4 May 2021 15:53:53 +0200 (CEST) Date: Tue, 4 May 2021 15:53:53 +0200 From: Lukas Wunner To: Mark Brown Cc: Joe Burmeister , Florian Fainelli , Ray Jui , Scott Branden , bcm-kernel-feedback-list@broadcom.com, linux-spi@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, nsaenz@kernel.org, phil@raspberrypi.com Subject: Re: [PATCH] spi: bcm2835: Fix buffer overflow with CS able to go beyond limit. Message-ID: <20210504135353.GA12996@wunner.de> References: <20210420083402.6950-1-joe.burmeister@devtank.co.uk> <7c9f9376-1a80-b624-7b9e-0f6d04437c02@devtank.co.uk> <271ad212-a606-620e-3f0c-d6bff272be3c@gmail.com> <380624c4-82f3-0e6e-8cdb-8a9732636db8@devtank.co.uk> <20210423115724.GB5507@sirena.org.uk> <672e8d77-ee5c-f10f-0bd3-f8708dfc24c8@devtank.co.uk> <20210423162055.GE5507@sirena.org.uk> <20210501195135.GA18501@wunner.de> <20210504115130.GA7094@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210504115130.GA7094@sirena.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 04, 2021 at 12:51:30PM +0100, Mark Brown wrote: > On Sat, May 01, 2021 at 09:51:35PM +0200, Lukas Wunner wrote: > > I failed to appreciate that when I changed num_chipselects for > > spi-bcm2835.c with commit 571e31fa60b3. That single line change > > in the commit ought to be reverted. > > > And the kernel-doc ought to be amended because the crucial detail > > that num_chipselect needs to be set to the maximum *native* chipselects > > isn't mentioned anywhere. > > Can you send patches for these please? Yup, I've cooked up two patches over the weekend, one bcm2835 short-term fix for-5.13 and one long-term solution for-5.14, they're on this branch: https://github.com/l1k/linux/commits/bcm2835_spi_limit Just needs some more polishing and testing before submission (hopefully in the second half of this week). > > Unfortunately that's non-trivial. The slave-specific data is DMA-mapped. > > It could be DMA-mapped in ->setup but there's no ->unsetup to DMA-unmap > > the memory once the slave is removed. Note that the slave could be removed > > dynamically with a DT overlay, not just when the controller is unbound. > > > So we'd need a new ->unsetup hook at the very least to make this work. > > There's the cleanup() callback which seems to fit? Right, I initially missed that but found it and then prepared the patch on the above-linked branch. Thanks, Lukas