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 0A9C3C433FE for ; Sun, 2 Oct 2022 14:27:16 +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-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:To:Subject:MIME-Version: Date:Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hswIJxBfFxUnK/VSlYCCRPksSkTPJ/PaajTzZOkEm1c=; b=LKY3qxicQgPVvSBycY58TyigG0 RbREgHtxtrpirTYLQNhOGtE/WAOwOiYLovqAVBiOXSBYZi3AeJPo43krrTvI4foYKxGo4uMw/2R9G p/ODFQ0DvtMkzJnNWhMLYcxSPT5sNq9ES7wXIP84KYtdw0rg95Cs6Y5cmhEdqzhbeOEPT8SrDHyyb 7cq+xcy8p6Ko0qFXXFi4npA/H9b+AHljQUUIoQlQBsypNJOHAa4v2OrdfpZNm9QYq7GhFXeD91leT ZT7kUM6TFcxq3/tZuFpQNVdDZhOFtmIZQuoYb56KCb96BnbDdvJFjLgrbaoVjZpnpHqopgzXdt9I9 WaM3aNcA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oezup-001Sqq-3g; Sun, 02 Oct 2022 14:25:59 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oezum-001SqE-5o for linux-arm-kernel@lists.infradead.org; Sun, 02 Oct 2022 14:25:57 +0000 Received: by mail-lf1-x130.google.com with SMTP id a8so13274367lff.13 for ; Sun, 02 Oct 2022 07:25:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=gxTqR0Ey2zRGFAUJiTDVmDjU/UZZW0WZ5gZEg22u3Wk=; b=jGnsuOP2BMD7JALE54C+npRn7uDNrfknnPc4XoFlhqP3O5ytopAP9/R8NwM3PMwoBv zT2lZBhtCf1RkuHWXEgu1A1qvGdG1a+qfDnAYS3nQHPYqv/uB/MTY0pN+PtY/gKlGimJ K1wkNPbnwxpkwq0eysMLflHyfPL0fOXNPmhdu9HjFbQosJTdyViC1f8xEz/SAEAxlZOJ zhALucQNra65JJZNjp2KrNFhaosfTTLaZ65L4W+/HTSMhTHeIFrtV9a3MfNhk9/czVH6 GRutJpvguYne9QMTdBoHiXHDEf7u9rkHUnILZW9/dbEXz8jW+8NmG+HJiDEt/5fM1fAe iX+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=gxTqR0Ey2zRGFAUJiTDVmDjU/UZZW0WZ5gZEg22u3Wk=; b=Oan3Bj2dI09+4FfilkcKcJg+07nfkTcsw/PjOMWmqgm8OMdppJwxCmdOlCW+PJJDDK nEvLjN8p6ZUGBMPpFfvS1Iz5VhoyPBOEe7O+Jkp6Rs7frZs1gzoCPcEuTn2nOkmhfYyM 7SlonpdjxCHWJdQM0J1YLBZZ0Ad/cGOfHHjWWJWjZlKezBepJoNSZIN0PEhSmBO3R0oQ ojaDPOj1NlF0MEuUMM6UCzvrtcmphtOpo7JcFwLMjOxJci3E4TE5iVq2Z63a2aRMWery 8YV90lC0y3z/1kpN0GB5SIvaAVoxLEEiLrprUAavUTzU1nay4PE3jer2/gLxMYAddmYG LBeA== X-Gm-Message-State: ACrzQf2qQtzh1a8P3NRY0T8F2ZPX4+yS4S/c3QNmDCmhqkPC0L51uszd CxYlSDL/l+h9E11SVb7finE= X-Google-Smtp-Source: AMsMyM7m7VInrlw3wi4/yW200f1frbq/JSXeri3ENLMmDbOyWr8ifLVIGnHwkYh+TbO6im/nsFplgw== X-Received: by 2002:ac2:5cd1:0:b0:4a2:291a:9460 with SMTP id f17-20020ac25cd1000000b004a2291a9460mr1803288lfq.203.1664720752562; Sun, 02 Oct 2022 07:25:52 -0700 (PDT) Received: from ?IPV6:2001:14ba:16f3:4a00::1? (dc75zzyyyyyyyyyyyyyyt-3.rev.dnainternet.fi. [2001:14ba:16f3:4a00::1]) by smtp.gmail.com with ESMTPSA id a18-20020a05651c031200b0026c5579c64csm648964ljp.89.2022.10.02.07.25.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Oct 2022 07:25:51 -0700 (PDT) Message-ID: <3ebe3c45-e951-678b-ea55-89c5bf62e8bc@gmail.com> Date: Sun, 2 Oct 2022 17:25:48 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [RFT PATCH v2 2/2] iio: Fix unsafe buffer attributes Content-Language: en-US To: Jonathan Cameron References: <614bb5336c2922578da60a43570f42018623557a.1664610071.git.mazziesaccount@gmail.com> <20221002145644.16db3aec@jic23-huawei> From: Matti Vaittinen In-Reply-To: <20221002145644.16db3aec@jic23-huawei> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221002_072556_288167_5F80DE44 X-CRM114-Status: GOOD ( 18.54 ) 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 , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 10/2/22 16:57, Jonathan Cameron wrote: > 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. Agreed. Besides, backporting the fix to stable will be much easier that way. I'll split this for v3. Thanks for the input! Yours, --Matti -- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel