Received: by 10.213.65.68 with SMTP id h4csp267902imn; Tue, 20 Mar 2018 03:05:08 -0700 (PDT) X-Google-Smtp-Source: AG47ELsZjplbw0Xmt+Y/Z50MtnNdTdmGNRIqYGE2W/QpLWMhRisczxWXT5iy0+6ns4cQv23nyxAz X-Received: by 10.99.117.86 with SMTP id f22mr11407920pgn.180.1521540308291; Tue, 20 Mar 2018 03:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521540308; cv=none; d=google.com; s=arc-20160816; b=twtj31HFs9pTn2QIAAu8O4Cax4wVonZEXkb63wGV1YcBAXjQ/5gfRcKq+ajy05Pipw jjHudXLnhie6D9+1cEr8EEEaseYJxrlI6nf5VPnbVFJH8oGSK7Ag6RaAJ66RcelPpfm2 ve2fAW7CQ7mop6eU0l4SkAWyOPBg+VoajBlksl/XCdWaD5EYZwToYuSeSJduHFPJDAzp yL7W3TWoLr6RFW8xizm+DTq5JMV7TjAPpsu1fatOIZ2lOmEPVPl2P2l0nYjPQ098MlfQ MseA/wJkNh+clQ45er3GfzawqG8LgjMrV5EOIBWPO3QFqkYr8uVEE6MKvtDXaIODNGji hWTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=y6YQF6/sf75kMooMdd3zmDyY0xxEoZyD/ZotRSSINiU=; b=Vohj5ZoSq84/4mW7+pMNYPIFY6gcTtIANKa1eM6b598HRr+tEUqf7fLyXuaTw6YItD t3dStScNZMSjMdFhVFMWxsBqqNYCptEGZkj+sYzr0nlO+PKMI8Xdn7Nc5NMINilHwqIS sS3Bl00wVIrLkl0Z4VvrGvhzoFJVC4GMPbT4sZ3FRJ8VdDCTka0AGdtAst9ZA0Z7VIFc 2XW4Ka5FGL2VB4U2dK3EbTyAj+6Gwj1dew+WFdeIKetnmxTLCeETmYhRpf8nfmAjlByD OmXhtgi8xU2TXmEAdLi/JS6HQRLToSMvgX8Qa1e03UxIF6gGlOL/VAEWM545VrZFVyS7 cLkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1si942890pgv.668.2018.03.20.03.04.53; Tue, 20 Mar 2018 03:05:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752627AbeCTKDV (ORCPT + 99 others); Tue, 20 Mar 2018 06:03:21 -0400 Received: from mx-rz-2.rrze.uni-erlangen.de ([131.188.11.21]:60725 "EHLO mx-rz-2.rrze.uni-erlangen.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751976AbeCTKDS (ORCPT ); Tue, 20 Mar 2018 06:03:18 -0400 Received: from mx-rz-2.rrze.uni-erlangen.de (mx-rz-2.rrze.uni-erlangen.de [IPv6:2001:638:a000:1025::15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx-rz-2.rrze.uni-erlangen.de (Postfix) with ESMTPS id 4057mP3nLgzPlZ7; Tue, 20 Mar 2018 11:03:17 +0100 (CET) Authentication-Results: mx-rz-2.rrze.uni-erlangen.de; dkim=none reason="no signature"; dkim-adsp=none (unprotected policy); dkim-atps=neutral X-Virus-Scanned: amavisd-new at boeck1.rrze.uni-erlangen.de (RRZE) X-RRZE-Flag: Not-Spam X-RRZE-Submit-IP: 23.129.64.102 Received: from uni-erlangen.de (xanaduregio.emeraldonion.org [23.129.64.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: U2FsdGVkX19EDWQlIJDUnkMR6GE/hM8TotuX+T7URHQ=) by smtp-auth.uni-erlangen.de (Postfix) with ESMTPSA id 4057mG1ScJzPlZp; Tue, 20 Mar 2018 11:03:09 +0100 (CET) Date: Tue, 20 Mar 2018 11:02:53 +0100 From: Jonas Rabenstein To: Christoph Hellwig Cc: Jonas Rabenstein , Scott Bauer , Jonathan Derrick , Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 11/11] block: sed-opal: check size of shadow mbr Message-ID: <20180320100253.bqokfsd3htqhhljx@studium.uni-erlangen.de> References: <72e19ec70ffac23fff658c60eaae0db850150ca1.1521482296.git.jonas.rabenstein@studium.uni-erlangen.de> <20180319200151.GK3380@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180319200151.GK3380@lst.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 19, 2018 at 09:01:51PM +0100, Christoph Hellwig wrote: > On Mon, Mar 19, 2018 at 07:36:53PM +0100, Jonas Rabenstein wrote: > > Check whether the shadow mbr does fit in the provided space on the > > target. Also a proper firmware should handle this case and return an > > error we may prevent problems or even damage with crappy firmwares. > > > > Signed-off-by: Jonas Rabenstein > > > > diff --git a/block/sed-opal.c b/block/sed-opal.c > > index 51f8034edbf7..9c73bd24c55f 100644 > > --- a/block/sed-opal.c > > +++ b/block/sed-opal.c > > @@ -1545,6 +1545,20 @@ static int write_shadow_mbr(struct opal_dev *dev, void *data) > > u64 len; > > int err = 0; > > > > + /* do we fit in the available shadow mbr space? */ > > + err = generic_get_table_info(dev, OPAL_MBR, OPAL_TABLE_ROWS); > > And here it gets used. So this should be merged with the previous patch. Thought, as the previous one provides a generic interface which is only used here for this specific use case, separate patches would be better. But I will merge them in a v3 with all the other comments on the other patches.