Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3427012imu; Sun, 11 Nov 2018 14:51:16 -0800 (PST) X-Google-Smtp-Source: AJdET5cper4mltnI1LeYcmk5/ULQsjOtTy3s0WN9Czxj8KQmM6h9Pc6xZSuLe7GgoLVYwfcIsjSt X-Received: by 2002:a62:160c:: with SMTP id 12-v6mr17733510pfw.45.1541976676893; Sun, 11 Nov 2018 14:51:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541976676; cv=none; d=google.com; s=arc-20160816; b=EevynbO0PH0KiSh0yuJ2eMsy6EF/jVTN4gg3KzPoqszQQrC/iO3Df/h3mliBBGMUi6 VwmC4TStsUii5NNoX4CdPYSYOcH/XlbzImjT8GX1bxcTcNmBqin3BI6DgYUPTPmT15Lk bdd6HijnPeuY4gCDZ56rCfRUZJe76b33gBs0VRoJi1oPOnjwHTWnqy8ZbFiz6inIdlV1 cRXR8AZzIvVFSW8PIhbXQSf6TuDcyPD/08vjpWgfIctkwax+m47GVAVpgevgj8/0/YID EQ0tSSsHQWqs9okkH8bLh6F7c2eP1/jemqiHSqXa4UeDIw5JM7oTCldmt67SH1826hrB fb6w== 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=YLCixhnCsZFwTX7kEWctof/YVozJnDfEAOVifWR3di0=; b=zd+zVY+pYoS8QbhXkHfsLfVN0IwLkrY5vP7ku8FoRTY7mYORlncOzfFgoQ2XM3M+jF hrkzrStg3Q5RSMNorDLJIJUkGp+ttAgzD4enxYD0jOQYZxgoeghd3fITCayJr6TGAca6 GO/niq6a7oFHYyjraVZpdSvxPx5Xp/QICQsNT4zqARYbkqEfzROV2hoBH+KTkaLD7dKS AWgIglzoZ/0EZmJTY5WAKriVS8m2wSGd1F/K/0Eb61nsBwsDjaHuv7qwAlE+UGLnW2gE iIWjhnSiGhtMq2UrWr8XTHcfToCWRFPjdgjEE/fYcqWIfmec8pwb8Yk1fgX35Nq9GS5P 2bQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nFCE5yEI; 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 e188-v6si12286782pfe.203.2018.11.11.14.51.02; Sun, 11 Nov 2018 14:51:16 -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=nFCE5yEI; 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 S2404316AbeKLIXQ (ORCPT + 99 others); Mon, 12 Nov 2018 03:23:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:56460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404230AbeKLIXP (ORCPT ); Mon, 12 Nov 2018 03:23:15 -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 1EBFA208A3; Sun, 11 Nov 2018 22:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975598; bh=61PNrZ4E5WYtSKWPUsX/RdkGQgXelbZgb9dk+luOO7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nFCE5yEI3/ie/InW66yTMe9w13sPv6qIQyxlyMAtWx25T2RQxAlojUC94JRhgCNqj 661I1UVWa2GIv+kPiVcenF6e84+PsejVvTojd/Q+Qhb6AYrfjWiGqbDihnDyVQtUwB Kv1S5Ww2SCrJ2mxqKwWrVfTEjyGzZ4Eem9fmXxM4= 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.14 183/222] xen-blkfront: fix kernel panic with negotiate_mq error path Date: Sun, 11 Nov 2018 14:24:40 -0800 Message-Id: <20181111221703.369541857@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@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.14-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 @@ -1910,6 +1910,7 @@ static int negotiate_mq(struct blkfront_ info->rinfo = kzalloc(sizeof(struct blkfront_ring_info) * info->nr_rings, GFP_KERNEL); if (!info->rinfo) { xenbus_dev_fatal(info->xbdev, -ENOMEM, "allocating ring_info structure"); + info->nr_rings = 0; return -ENOMEM; }