Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp4536499imd; Tue, 30 Oct 2018 03:42:25 -0700 (PDT) X-Google-Smtp-Source: AJdET5dxLF2TwQh1Zr0Bp9TqjlhjPJROLLFGWNBn3YPQGbPqlfXhN0ZJlvbgyXIr8J63pRAOu7U1 X-Received: by 2002:a63:ff1b:: with SMTP id k27-v6mr11727363pgi.199.1540896145592; Tue, 30 Oct 2018 03:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540896145; cv=none; d=google.com; s=arc-20160816; b=HBuXQ8pa2qCHfwecVBbpCIu3sdZlUt3FbcQPBK/sNSRnOiklvudtnvpAnE8wPruigi ELzXuVIc1gW02tNy2D4uXANVnHw55506ceJFnJLO+1g5ciwmzXyDnhvRaA2th2DuvOsO 1yxTJwrqlxjrNqYa4N0H1mBmnSivaNvxFbHoRkyLi2VFT6dpFruekYSGg7bqFMWPFAXh fp755Y8/VnqID+p01/gFTEN5fCBcbErs9/ik5I2h7owKKLu+jNpn33q8pkscRNy2dLhy dKhqElYltYHW96hvZZHsejtpLJ3yIFl6o1hXg9rKQEczXxdS7EWx8TfBaN0txi7vQPLW BXxQ== 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; bh=DUKgBLXfd5377A0E8oK7HuccxOMzQ3L+Qu8DVX4+/eo=; b=NXkyrpwWbcQB1u5at0XkylMfgl10iCH3W6nqx1fKB4At3n3+vGhJZndONcKvmuNmc2 veTYBsIoGZA7yqj+6nx7O2QVX1xIM78E04doPGI3ZjUtZnxPuZLeS8bRqUq8wGdVvoC2 dLpiy7lZe3mJY1m4dlolhL6QEGgcBlZMJcBssyszvwIcwjhnicYbFEAzMBWeD3yEIrom P4I7Yzh6tMq6vOHfc9s32d9jXaWEq+zxp2CPBchiXOoUqF6SGdbP7j7c91V3EhPFtBce Oa3x6WpshM/n/p23r3rndWoajskxL8MYtJvjyS0QGGR1VGu0IlSdmDxOSGiHetJNGKYi Flcw== 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 g9-v6si22170379plo.328.2018.10.30.03.42.10; Tue, 30 Oct 2018 03:42:25 -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 S1727603AbeJ3TdD (ORCPT + 99 others); Tue, 30 Oct 2018 15:33:03 -0400 Received: from smtp.ctxuk.citrix.com ([185.25.65.24]:4341 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727573AbeJ3TdD (ORCPT ); Tue, 30 Oct 2018 15:33:03 -0400 X-IronPort-AV: E=Sophos;i="5.54,444,1534809600"; d="scan'208";a="81138997" Date: Tue, 30 Oct 2018 11:39:56 +0100 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Manjunath Patil CC: , , , , , , Subject: Re: [PATCH] xen-blkfront: fix kernel panic with negotiate_mq error path Message-ID: <20181030103956.hew7gifjvpjviw7u@mac.citrite.net> References: <1540837916-14356-1-git-send-email-manjunath.b.patil@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1540837916-14356-1-git-send-email-manjunath.b.patil@oracle.com> User-Agent: NeoMutt/20180716 X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 29, 2018 at 11:31:56AM -0700, Manjunath Patil wrote: > info->nr_rings isn't adjusted in case of ENOMEM error from > negotiate_mq(). This leads to kernel panic in error path. > > Typical call stack involving panic - > #8 page_fault at ffffffff8175936f > [exception RIP: blkif_free_ring+33] > RIP: ffffffffa0149491 RSP: ffff8804f7673c08 RFLAGS: 00010292 > ... > #9 blkif_free at ffffffffa0149aaa [xen_blkfront] > #10 talk_to_blkback at ffffffffa014c8cd [xen_blkfront] > #11 blkback_changed at ffffffffa014ea8b [xen_blkfront] > #12 xenbus_otherend_changed at ffffffff81424670 > #13 backend_changed at ffffffff81426dc3 > #14 xenwatch_thread at ffffffff81422f29 > #15 kthread at ffffffff810abe6a > #16 ret_from_fork at ffffffff81754078 > > Though either of my changes avoid the panic, I included both the > changes. This issue got introduced with "7ed8ce1 xen-blkfront: move > negotiate_mq to cover all cases of new VBDs" > > Signed-off-by: Manjunath Patil > --- > drivers/block/xen-blkfront.c | 7 +++++-- > 1 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c > index 429d201..dc8fe25 100644 > --- a/drivers/block/xen-blkfront.c > +++ b/drivers/block/xen-blkfront.c > @@ -1350,8 +1350,10 @@ static void blkif_free(struct blkfront_info *info, int suspend) > if (info->rq) > blk_mq_stop_hw_queues(info->rq); > > - for (i = 0; i < info->nr_rings; i++) > - blkif_free_ring(&info->rinfo[i]); > + if (info->rinfo) { > + for (i = 0; i < info->nr_rings; i++) > + blkif_free_ring(&info->rinfo[i]); > + } I don't see the point in the if case here, you already fixed it by setting the nr_rings value which I think it's the correct way of fixing it. Thanks, Roger.