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 X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80212C433E6 for ; Wed, 3 Mar 2021 19:09:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 34B8F60295 for ; Wed, 3 Mar 2021 19:09:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1578762AbhCCSRy convert rfc822-to-8bit (ORCPT ); Wed, 3 Mar 2021 13:17:54 -0500 Received: from lithops.sigma-star.at ([195.201.40.130]:49602 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346523AbhCCQSJ (ORCPT ); Wed, 3 Mar 2021 11:18:09 -0500 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id C0AEF6083244; Wed, 3 Mar 2021 17:17:18 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 47tz6j-1yi-U; Wed, 3 Mar 2021 17:17:16 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id A02CD6083275; Wed, 3 Mar 2021 17:17:16 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id S4uJLM3KDg-S; Wed, 3 Mar 2021 17:17:16 +0100 (CET) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id 7E9876083244; Wed, 3 Mar 2021 17:17:16 +0100 (CET) Date: Wed, 3 Mar 2021 17:17:16 +0100 (CET) From: Richard Weinberger To: Michael Walle Cc: linux-mtd , linux-kernel , Miquel Raynal , Vignesh Raghavendra , Greg Kroah-Hartman Message-ID: <689194005.42755.1614788236355.JavaMail.zimbra@nod.at> In-Reply-To: References: <20210303155735.25887-1-michael@walle.cc> Subject: Re: [PATCH] mtd: require write permissions for locking and badblock ioctls MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Originating-IP: [195.201.40.130] X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF78 (Linux)/8.8.12_GA_3809) Thread-Topic: require write permissions for locking and badblock ioctls Thread-Index: KRfYtqpl1pr2bZDMHpym/f0qKEWheA== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Michael, ----- Ursprüngliche Mail ----- > Von: "Greg Kroah-Hartman" > An: "Michael Walle" > CC: "linux-mtd" , "linux-kernel" , "Miquel Raynal" > , "richard" , "Vignesh Raghavendra" > Gesendet: Mittwoch, 3. März 2021 17:08:56 > Betreff: Re: [PATCH] mtd: require write permissions for locking and badblock ioctls > On Wed, Mar 03, 2021 at 04:57:35PM +0100, Michael Walle wrote: >> MEMLOCK, MEMUNLOCK and OTPLOCK modify protection bits. Thus require >> write permission. Depending on the hardware MEMLOCK might even be >> write-once, e.g. for SPI-NOR flashes with their WP# tied to GND. OTPLOCK >> is always write-once. >> >> MEMSETBADBLOCK modifies the bad block table. >> >> Fixes: f7e6b19bc764 ("mtd: properly check all write ioctls for permissions") >> Signed-off-by: Michael Walle >> --- >> drivers/mtd/mtdchar.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) > > Thanks for auditing the rest of these from my original patch. If this > is ok with userspace tools, it's fine with me, but I don't even have > this hardware to test with :) That's my fear. Michael, did you verify? In general you need to be root to open these device files. So, I don't see a security problem here. Thanks, //richard