From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756763AbcA2TXq (ORCPT ); Fri, 29 Jan 2016 14:23:46 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34373 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756709AbcA2TXp (ORCPT ); Fri, 29 Jan 2016 14:23:45 -0500 Date: Fri, 29 Jan 2016 11:23:41 -0800 From: Brian Norris To: Ezequiel Garcia Cc: "linux-mtd@lists.infradead.org" , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , Boris Brezillon , "linux-kernel@vger.kernel.org" , Bayi Cheng , Marek Vasut , Daniel Kurtz Subject: Re: [PATCH 4/8] mtd: spi-nor: disallow further writes to SR if WP# is low Message-ID: <20160129192341.GD19540@google.com> References: <1453960307-10181-1-git-send-email-computersforpeace@gmail.com> <1453960307-10181-5-git-send-email-computersforpeace@gmail.com> <20160128175905.GA33340@google.com> <20160128194836.GA63180@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 29, 2016 at 10:22:34AM -0300, Ezequiel Garcia wrote: > On 28 January 2016 at 16:48, Brian Norris wrote: > > On Thu, Jan 28, 2016 at 04:24:50PM -0300, Ezequiel Garcia wrote: > >> How about this: > >> > >> 1) ioctl(MEMLOCK) the entire flash (SR_SRWD is set) > >> 2) ioctl(MEMUNLOCK) partially (SW_SRWD keeps set) > >> 3) ioctl(MEMLOCK) the entire flash again ... > >> but would (3) be allowed given > >> SW_SRWD is set? > > > > Yes, if /WP=1 (high). > > > > Right. So, after giving some more thought do this, I'd say it might > make sense to clear SRWD only when unlocking the entire flash. If > anything else, it would allow a path to disable hardware protection on > the lock range? Yes, that sounds fine to me, as it does allow removal of the HW protection. So one could, for example, do: 0. bring /WP=1 (high) 1. unlock the whole flash 2. bring /WP=0 (low) -- flash is still unlocked 3. allow a one-time relocking of the flash via MEMLOCK 4. no more locking changes I'll send out v2. Brian