Received: by 10.213.65.68 with SMTP id h4csp38816imn; Mon, 19 Mar 2018 18:48:54 -0700 (PDT) X-Google-Smtp-Source: AG47ELuX5zEB3BdnwLkTmpBczoh716T/86G8ITVJ1VDGleM1IBIDOAZFcHcWnXvLKVvSOlYA1MTG X-Received: by 2002:a17:902:8a92:: with SMTP id p18-v6mr14319098plo.286.1521510534373; Mon, 19 Mar 2018 18:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521510534; cv=none; d=google.com; s=arc-20160816; b=gfYe7lkXZDPEsNbxewl0zNtbcllgzXnKSPH2iw1+ID6Wtb6JdaQOqT1XcWUEceqW3s bicfo6QUD8DqWSnH+2Keip+SIAsv8+u5pKbDH9pD5ebC31Y3L8svpfxGnE5x7ZQbXPXm nuHQ+qhekbnYM6xKIx8HMmWdSR3HUEtUI3xOdOk/JxM3OG62pDGmjP/cbM+li7et7Iuc 9kI1V77mXp6mALnlDdCfzZ0hCO4ssLs4qONz2GirMO6gG9G73BnwmCb3oAet8t77Qj2D 2ccEskn2clhT0u7Mki3+nk9YvIuYFn8wRg3LqfeYc/AAMZebNMqrtlx/3BM/dGPrBSpT l20g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=UKyCIylpAK+v+cwP1HVJR6+DTJp2PbP4sXUGnhHwiWI=; b=Dvwwo/l+w9DDk3+E6d2zK4StMTH5hVrqBTZzIVY/DhCTaOLuIsYKRJPbW7XyU5/Qry kX/dKiu7G5n1f1FxmuOJNcRcoJa0UP3TkvmKaNuucN+sNB1q8PWQreHdGWwX+gTCdQsE XQhiXUZ7GHFqojVdFrP12laRBj1kWZAH5cL4uiX+1FuhFeSca87P7x/u0xHi7orsNtT5 e6HnQd1WG97V8p9C7PBNzoDwf8qd2UrvaHmY5cBinjvTkkT1kkz1fpHZ+tFogonwuW2f iBRZA2SyzuMC4/LLWbuMRaLjQbUuZQ5qb5AJ0AaGezTR+L9meLWrOZ6etWUTV8iieeG4 L2yA== 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 o5si373355pgv.825.2018.03.19.18.48.40; Mon, 19 Mar 2018 18:48:54 -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 S971085AbeCSUB4 (ORCPT + 99 others); Mon, 19 Mar 2018 16:01:56 -0400 Received: from verein.lst.de ([213.95.11.211]:33050 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S971073AbeCSUBw (ORCPT ); Mon, 19 Mar 2018 16:01:52 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 1969E6F233; Mon, 19 Mar 2018 21:01:51 +0100 (CET) Date: Mon, 19 Mar 2018 21:01:51 +0100 From: Christoph Hellwig To: Jonas Rabenstein Cc: Scott Bauer , Jonathan Derrick , Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: Re: [PATCH v2 11/11] block: sed-opal: check size of shadow mbr Message-ID: <20180319200151.GK3380@lst.de> References: <72e19ec70ffac23fff658c60eaae0db850150ca1.1521482296.git.jonas.rabenstein@studium.uni-erlangen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <72e19ec70ffac23fff658c60eaae0db850150ca1.1521482296.git.jonas.rabenstein@studium.uni-erlangen.de> User-Agent: Mutt/1.5.17 (2007-11-01) 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 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.