Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1767723rwb; Sun, 2 Oct 2022 07:36:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TuMUeEN8/TS0Ff4hWG1Sp8Jayk2KJ4vzfN8PGdOLqvJSH9DWMpsHsDuFqI1QMMzJUq7Mb X-Received: by 2002:a17:902:6b8b:b0:178:7cf5:ad62 with SMTP id p11-20020a1709026b8b00b001787cf5ad62mr17742015plk.13.1664721413354; Sun, 02 Oct 2022 07:36:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664721413; cv=none; d=google.com; s=arc-20160816; b=rIaLbQtQE/61ISypCnDmsxC4TaqLKD9OkLCQ0qKWhO8yNPy09zxma8WQxwjlQ8GzT5 R1cIMdzx5joDA98Ckd+Vk/jTLFs1OLWXyiMQpLR64PV5EdSNGWXogFFt1uHMFFFmkqTw RvmZY10SoDSvSZR8pvwqR0RCVgcrS3vChIhHIMoK5xWkCeMLsStFHp8aDAwi0Gwa/2/y XhY0QLQ2iWpzPz+5+FYtFS7w+d3a2hTMCbx6BUR6eCw0IaCLg1ieTgZlXjj7XCN0/Wio PbF17U7ux8gNm0Po6wc14Mkwp5eDeroRYn+cjvkLW+GVnMXH8JTNEhcpjp0TYYN5NZgn OBIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=gxTqR0Ey2zRGFAUJiTDVmDjU/UZZW0WZ5gZEg22u3Wk=; b=baYOAn/p4Wa9xRLvqSQ7Xl9yPHZd5OJ4rDTG7J06tYg1PYbg/Dpc5cMY5M2L5CcTb1 1uO92bxk5/qh15+za52TMneORk8jVjQG33cjbt2kSzjR4UxsWxW9oseypQ5G5wf0WjYv KLJMI+7icjGDX2YDxzieSoBAf5piqHG8MuinG21iheLhm/r5aFEdNBWgpQEYL6ee8zbF knrR06aZ10S0W3v+Qd0KkiBmD/jeoGiAzM/klNjMmuwFFeconRpRtIMIFKM/5IuR54b/ oCy9slGfd/X8CkaxN3M5iE4zaMOHN5HrwuzYDer87xaD2b3DfniDhmbkJcCfK/6JIUjM 8ACg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jGnsuOP2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o8-20020a634e48000000b004406aa1d01fsi7082060pgl.850.2022.10.02.07.36.35; Sun, 02 Oct 2022 07:36:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jGnsuOP2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229672AbiJBOZ6 (ORCPT + 99 others); Sun, 2 Oct 2022 10:25:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbiJBOZ4 (ORCPT ); Sun, 2 Oct 2022 10:25:56 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59D723BC43; Sun, 2 Oct 2022 07:25:54 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id c2so6950727lfb.10; 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=KLC6RE5HlP7kP0QpzKvOs0iffa5wlSCREyA57zoaF/6vxkRvWhbUmolSpN8Hua4XVy zY2jC30BsOiuMxpJvwCGbPmiBrrLTvqXXA3WBFt4s6EWepUfHjLvRKcsCJtXAvM2OJJ2 xbhXBvtsIvUt7GhEoO2zsyZkhU7kp6kyBWv4vinByU5dsisxYeSr1YfXmHixBuFlI6+g W4d+b4napEFnMlnPvIGBzDSG0hqa7K6KuNWo7ZCXqnab44COoGHWODot8846a7j2s3Ek eTHp7PnRFPMqJWWaLCsD6ouOhiYcTsHMYYbAqYdheGIDobQJ8Uy/job1hor/mnJs3E/5 WrPw== X-Gm-Message-State: ACrzQf2F3HfPSY/XLpUv1YMZ6uUKG+1qOCK2CyHKRej9ydVkLvP+OVUP O/xDD3LWFdwOy/lYhsBwk58= 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 Cc: Matti Vaittinen , Cosmin Tanislav , Lars-Peter Clausen , Michael Hennerich , Eugen Hristev , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Benson Leung , Guenter Roeck , Alexandru Ardelean , Srinivas Pandruvada , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Nathan Chancellor , Miquel Raynal , Miaoqian Lin , Paul Cercueil , Mihail Chindris , Gwendal Grignou , Douglas Anderson , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev References: <614bb5336c2922578da60a43570f42018623557a.1664610071.git.mazziesaccount@gmail.com> <20221002145644.16db3aec@jic23-huawei> From: Matti Vaittinen In-Reply-To: <20221002145644.16db3aec@jic23-huawei> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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! ~~