From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A22CC433FE for ; Sun, 2 Oct 2022 13:58:42 +0000 (UTC) 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=avRuPMtdy3rOVKtjskSgRa7AYP4nkHjVx/jjc5YF0lQ=; b=xMgUdbbxIOggc7 zuMErZHkCRvUozmnGwFNCKeQihzKQEuSXUUzi8rXsZxILBUnx0aeP2injUHd6q0F4VyFqjOP8IwH9 98Qx8lWNtcq4/8KDj3nLknHOoFR+VJPhzbx1rGt07vOam8b7TcKN7WDRVBWuyMbRAGD7wb9ETkzj6 2GnhxKW1OEX4hZeNZYO5PmtRiuKj6DX0+GeRKKGnJ4diyyTY6qPVsR+0gLtlOl8qLjKOXLaL31mYH U5aDRbumwF027Jnb8ePVqyF/sr4gf/tAl3COup43FW1Pls1elCn0vRd5ZErUYP/91lUlPNB6kP1IG UhK3kYvInGR9XLkOr6kQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oezSs-001OYK-Qg; Sun, 02 Oct 2022 13:57:06 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oezSp-001OW0-Lu for linux-arm-kernel@lists.infradead.org; Sun, 02 Oct 2022 13:57:05 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B796360DCE; Sun, 2 Oct 2022 13:56:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 897D1C433C1; Sun, 2 Oct 2022 13:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664719016; bh=YF4OVbnB9hzRJnIWJLAOYnGD8RwPg/JYl59+Nox2ao8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=APKOMb73H16T4v6RELKk2SVdyPtc3sBbH8Zrei+IE9X+o7aCnOaWW/9g++kq5DBwA hXE5uCMN0d/L9PoSXp/z0nQVbQlwnvGm4RDe1MeBvuGz4sYyRXS4jk2hFtLgHou8jc M+plTVFqC31zxaHq0TcS5lwIY7AeKwte2jwSrkgV7NE5eQvI0i7KHQJRCwjjkPCWY9 tzNTg2LNZs68IkAlYLGWCsZ34sAxuMVA+bhI7wDz2KTNV/JRbf3cBLTv8ZvcSpBiD4 lxEFip93DkwZepsZ/5Xlit2UHNKwevdrHkSDtAovppNIvMb0LBHJqLPFKs8uPsw5hL 4m+05kvY4ddrA== Date: Sun, 2 Oct 2022 14:57:08 +0100 From: Jonathan Cameron To: Matti Vaittinen Subject: Re: [RFT PATCH v2 2/2] iio: Fix unsafe buffer attributes Message-ID: <20221002145644.16db3aec@jic23-huawei> In-Reply-To: <614bb5336c2922578da60a43570f42018623557a.1664610071.git.mazziesaccount@gmail.com> References: <614bb5336c2922578da60a43570f42018623557a.1664610071.git.mazziesaccount@gmail.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221002_065703_841841_A33CDBBF X-CRM114-Status: GOOD ( 18.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Douglas Anderson , linux-iio@vger.kernel.org, Srinivas Pandruvada , Gwendal Grignou , Paul Cercueil , Miquel Raynal , Guenter Roeck , chrome-platform@lists.linux.dev, Lars-Peter Clausen , Miaoqian Lin , Uwe =?UTF-8?B?S2xlaW5lLUvDtm5pZw==?= , Alexandru Ardelean , Mihail Chindris , Michael Hennerich , Cosmin Tanislav , Nathan Chancellor , Benson Leung , linux-arm-kernel@lists.infradead.org, Matti Vaittinen , linux-kernel@vger.kernel.org, Eugen Hristev , Claudiu Beznea Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, 1 Oct 2022 10:44:23 +0300 Matti Vaittinen wrote: > The iio_triggered_buffer_setup_ext() was changed by > commit 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr") > to silently expect that all attributes given in buffer_attrs array are > device-attributes. This expectation was not forced by the API - and some > drivers did register attributes created by IIO_CONST_ATTR(). > > The added attribute "wrapping" does not copy the pointer to stored > string constant and when the sysfs file is read the kernel will access > to invalid location. > > Signed-off-by: Matti Vaittinen > Fixes: 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr") Hi Matti, This feels like we are doing too much in one go. I would start with fixes for each individual driver, then once those are in we come around again and do the refactor. So for the first patch set (one per driver) just siwtch to yor new dev_attr but still use a struct attribute * array. Second series then does the refactor so we don't introduce any new instances in future. More churn but the code to backport is more tightly confined. Thanks, Jonathan > > --- > > v1 => v2: > fix also industrialio-buffer-dmaengine.c and cros_ec_sensors_core.c > > The fix is only superficially tested by a ROHM/kionix KX022A driver. > Proper testing with real in-tree IIO stuff is _highly_ appreciated. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel