Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3471250imu; Sun, 11 Nov 2018 15:52:23 -0800 (PST) X-Google-Smtp-Source: AJdET5dAcDLBOgu2mUfI2opaGivjE7IMbnMSDVHGHsuIKjZlo5pd4k74MJHzBdE638y8preC+p/c X-Received: by 2002:a62:714a:: with SMTP id m71-v6mr18701710pfc.89.1541980343388; Sun, 11 Nov 2018 15:52:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980343; cv=none; d=google.com; s=arc-20160816; b=nbqPoMdWrXTSpo1StXLjzg/Js77GPLDduwndzj92HIVyHI5kXpSsjzfK4FdkcS8SaB N+URnq6OMDQEXUNWi+KrCP6XsW5InUlRBf4Rr0jQoSi4l107VdZnqU4K0k6Am9D3VXuv d/42h841ZNnvPI7APMU+gNTVDk+4fofQWo3aTfZ23pc93wM0y++lLtLHexHEcem8RT7L WUdynSiC2S7b5V4OnZOs8s0QI0TnKkRYttZppM4tpcS2VisdB4OI9sjR0SlQuRXDM2hi 2K9rEMvnkbJPPZD/awQROtXwehA1Xm7pa4l5B+Vj3qU/bhletJaEkMY18C8SOMFHVvlB xZ2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OSPU5DDrsgd9WaYrDIIw5eAwDtsO70Ip//Z+Dunv8HQ=; b=mVI1Yows4fwZ1g94kz2CoGH1B7vVvbd/zOx0iM39EbpZrbfPfHbLIQ8KHg8cVnjcHR V5Jl5ONkHLnk9qMkhLNMQoS7LhQ16W5mp9xEjT1n0ax5E4y9hBBg8Beo/63Fo+tuQutu aUGfMKRMD/hAe2X/AKMrnrnZl0VO0nWWYOqetquHCFRwMg2ySvQU0vynaedX133FUuvs PP5Gax3STNTDF2XEIOyNgUIlgCUcsvETv6PCCa8MrTN4t7YJWA83b5cXaqSgdMEVQrla AO8cqS+Lq1hdyJ3Wjgz3wvhIOlGbuAu8sDe+gm1P7WAy9i9ZLiY+FQPnHZ75zswZYyvR iopA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="y1qqWb/v"; 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 r4-v6si16916892pfb.43.2018.11.11.15.52.08; Sun, 11 Nov 2018 15:52:23 -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; dkim=pass header.i=@kernel.org header.s=default header.b="y1qqWb/v"; 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 S1732871AbeKLISb (ORCPT + 99 others); Mon, 12 Nov 2018 03:18:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:38100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732829AbeKLISa (ORCPT ); Mon, 12 Nov 2018 03:18:30 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E9E5F215EA; Sun, 11 Nov 2018 22:28:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975315; bh=XrwwBm1J4ySFzosyJKPX61WhdaZLbn+iQ71LOWcYyxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y1qqWb/vbGUnFlhinwMnv7G4Kh5IODC7f+12jG8Q8lJlQjRflV1BOtDk5fLd0hYDW Ow2BRCj9bir175ETAuH5UAz/uq9bDAp7P3hfsqgd59a4PVVzG8ojrzKnzCjy/MIynf oiserrcChhKaLa1sTETD23+w4LPDyMRhXEwFbRAg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manjunath Patil , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Juergen Gross Subject: [PATCH 4.19 301/361] xen-blkfront: fix kernel panic with negotiate_mq error path Date: Sun, 11 Nov 2018 14:20:48 -0800 Message-Id: <20181111221657.507499949@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Manjunath Patil commit 6cc4a0863c9709c512280c64e698d68443ac8053 upstream. 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 Cc: stable@vger.kernel.org Fixes: 7ed8ce1c5fc7 ("xen-blkfront: move negotiate_mq to cover all cases of new VBDs") Signed-off-by: Manjunath Patil Acked-by: Roger Pau Monné Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- drivers/block/xen-blkfront.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -1919,6 +1919,7 @@ static int negotiate_mq(struct blkfront_ GFP_KERNEL); if (!info->rinfo) { xenbus_dev_fatal(info->xbdev, -ENOMEM, "allocating ring_info structure"); + info->nr_rings = 0; return -ENOMEM; }