Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3653622imu; Tue, 18 Dec 2018 01:49:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/WUHhCI79BdSGATQHQVJwh+aiOSFsLktGwD4klJWBambMYPp+oG7SBUxz58h+8X7pAvzXKN X-Received: by 2002:a63:62c4:: with SMTP id w187mr10928750pgb.230.1545126554355; Tue, 18 Dec 2018 01:49:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545126554; cv=none; d=google.com; s=arc-20160816; b=OkAPsb7Ok1OiUEk4rCnAdHApOVDgE26TQ0r8/P0Id9osGzGnM3y9qIcK2iZdhdCvg0 2uaQaTf7H58yC6LskIdqapiFAC4Ob1fxvMzZYPsdvhQUQtgTDU5jNKoZ43v1eOAZDjBB AtSmj/xCcERZdKBduyDG310CYOgeq5DxJg3tQBpCAeCm6927bFRY2W/nQr/bDivpLsVt Q1+7IUAOhsxAlwQSltnfqEdqDzLpY1MpZ5OczK0JXdlQ8E8ovMwonepD/sAAUycSQtk+ crJep6+S1eUQfdwnv3XF7j0+URKWS1guiL5hldllq3Jo9jbq0Lqw+8SLZfFAiqOwSh0g Pdyg== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=ZFMJyQyCQHdaZyUPwWVMB10AVIZKIC5d/c5/D4+k+y0=; b=uRA7XrIIFiV8PuLgfp148rP8hG1P50+IRTHgHUp7a9YrBHXs9XnXeLho38eTm7oZKH hwUjdk0k0xXyeKShsgvYNHPJ2ewNokkP9Dh3fBQlwm9n7aAsuLGqj3hwrWqFbv19v/++ Dp0/bw7KhbbRoVaKVY4EqHHfNxlsRQpMGYAf1bjfbPv+FACIqgVHX0fIR8HrmcIpzjP0 wIkWx4x01VIM1ymO1r2Kwdhra5rtpqwyMGvdGOxJOfTnhouJD8t2apJbpvKOnREbBXay 17d2LEvlQZpiTb5Cw0/VVFWIlnSyPZptZ0IFEU4zdpgKS5oTAxA5lHoFPbCncJnVmO6G RLrg== 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 l4si13333605pgr.346.2018.12.18.01.48.55; Tue, 18 Dec 2018 01:49:14 -0800 (PST) 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 S1726388AbeLRJsE (ORCPT + 99 others); Tue, 18 Dec 2018 04:48:04 -0500 Received: from smtp.eu.citrix.com ([185.25.65.24]:42576 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726341AbeLRJsE (ORCPT ); Tue, 18 Dec 2018 04:48:04 -0500 X-IronPort-AV: E=Sophos;i="5.56,367,1539648000"; d="scan'208";a="83480673" Date: Tue, 18 Dec 2018 10:47:54 +0100 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Dongli Zhang CC: , , , , , Subject: Re: [Xen-devel] [PATCH v2 1/1] xen/blkback: rework connect_ring() to avoid inconsistent xenstore 'ring-page-order' set by malicious blkfront Message-ID: <20181218094754.dcja5rr7qlprscmp@mac> References: <1545094538-31426-1-git-send-email-dongli.zhang@oracle.com> <20181218093300.qfslnloxooqnu2im@mac> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20181218093300.qfslnloxooqnu2im@mac> User-Agent: NeoMutt/20180716 X-ClientProxiedBy: AMSPEX02CAS01.citrite.net (10.69.22.112) To AMSPEX02CL01.citrite.net (10.69.22.125) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 18, 2018 at 10:33:00AM +0100, Roger Pau Monn? wrote: > On Tue, Dec 18, 2018 at 08:55:38AM +0800, Dongli Zhang wrote: > > + for (i = 0; i < nr_grefs; i++) { > > + char ring_ref_name[RINGREF_NAME_LEN]; > > + > > + snprintf(ring_ref_name, RINGREF_NAME_LEN, "ring-ref%u", i); > > + err = xenbus_scanf(XBT_NIL, dir, ring_ref_name, > > + "%u", &ring_ref[i]); > > + > > + if (err != 1 && (i || (!i && nr_grefs > 1))) { > > AFAICT the above condition can be simplified as "err != 1 && > nr_grefs". Sorry, this should be "err != 1 && nr_grefs > 1", since it's not order but rather the number of grefs. Roger.