Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3290814pxk; Mon, 21 Sep 2020 09:49:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1xgpowAS2DSV8DFX5Lrm48Aij8YtjJ9yR7i3gdZdTfNDsW3zo4jvieRdW1IjaGKfbHYpV X-Received: by 2002:aa7:d4d4:: with SMTP id t20mr543997edr.229.1600706994512; Mon, 21 Sep 2020 09:49:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600706994; cv=none; d=google.com; s=arc-20160816; b=v+0Ysz4TVczfM4ok98C7i84j7FeTKz6CGvU/NO89Z+AY7oHRUMz23XW2e89h6AVZqX 3Rzat54aU6t08C0+x2ygAFX4SsRv5jHdpCus3Ha9f+SzPfcNv1FnbIWBQkehRvU01saS N7TjyUh8qR5KjmMLXU9AtSubjsMoilmPMYC6ALE3769dkKNIrVWTQQhzWt5h/89lMfNA eg6VdOoVD1VsbfYvSnvPa0t0RbAojfZ5Ud768gLAu/ytgfS/0IuzmL1CNxw8MajO+IZH 0whk+IaLpjjUq635eWnELchdzGOkUHFeJcVb3Flo7UmUX5sqps28CEXMTqkFl47FYi+p RtJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DClpT9tC7Bn/u1pkSHO0xBTbNZ0Df1KC9PN6atOBNdM=; b=D6Z3QGWWil9HWR1eLNMuV0WfOHZI4ILApJeq+GfZ+hlfq6TkiUVBqS0zANCkE9IGss U3SzXAlLzC9GH9JZkyJrQiuojcuhjAY6JYC9PVAfT98s6BHbNU6LCAnEnal/OMcxukHj SHIFrI+JqipjR2MFEmchwab9dznGg5XU+oauQr5i3j5abc84r+XozD5uFLF75e7P8Oli YJeBxNytwedQCZhit8s2Fb7osMdRj4ceA8M0Fz2G3J2qgEzoTlpOeInwVVl59wri9a68 1IIbX1LF0IERoCkZmPtjKy0vS7NahTvjnuh9F0fTuF7qgFDQcxcr/ODVB3zagkUOaUYq VeeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0yn1tJR0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm15si8494255edb.236.2020.09.21.09.49.30; Mon, 21 Sep 2020 09:49:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0yn1tJR0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729303AbgIUQqb (ORCPT + 99 others); Mon, 21 Sep 2020 12:46:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:52726 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728749AbgIUQq2 (ORCPT ); Mon, 21 Sep 2020 12:46:28 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 78F422223E; Mon, 21 Sep 2020 16:46:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706787; bh=eWCOIoW7uLgq7QZezx0n3yQs8ZcUiDT2ro+oDmpUx5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0yn1tJR0DBFy3AtEhu+L3BWrYN3R6pHbkxlYBDfAkrQnHRI7YMLQ75TDOIz7y2r9H XYDVxWWqBTrMcyKju5MsdAvvrIcCMfWarYckYqhWnrJnPUsJBiEFXNtC/U76Pq57tE pBDoD/e7lrGLml+EuPo+xAtnBrkTVUFe9UeznJ7s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , Dexuan Cui , Vitaly Kuznetsov , Wei Liu , Sasha Levin Subject: [PATCH 5.8 055/118] Drivers: hv: vmbus: Add timeout to vmbus_wait_for_unload Date: Mon, 21 Sep 2020 18:27:47 +0200 Message-Id: <20200921162038.899037678@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162036.324813383@linuxfoundation.org> References: <20200921162036.324813383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Kelley [ Upstream commit 911e1987efc8f3e6445955fbae7f54b428b92bd3 ] vmbus_wait_for_unload() looks for a CHANNELMSG_UNLOAD_RESPONSE message coming from Hyper-V. But if the message isn't found for some reason, the panic path gets hung forever. Add a timeout of 10 seconds to prevent this. Fixes: 415719160de3 ("Drivers: hv: vmbus: avoid scheduling in interrupt context in vmbus_initiate_unload()") Signed-off-by: Michael Kelley Reviewed-by: Dexuan Cui Reviewed-by: Vitaly Kuznetsov Link: https://lore.kernel.org/r/1600026449-23651-1-git-send-email-mikelley@microsoft.com Signed-off-by: Wei Liu Signed-off-by: Sasha Levin --- drivers/hv/channel_mgmt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 417a95e5094dd..af7832e131674 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -750,7 +750,7 @@ static void vmbus_wait_for_unload(void) void *page_addr; struct hv_message *msg; struct vmbus_channel_message_header *hdr; - u32 message_type; + u32 message_type, i; /* * CHANNELMSG_UNLOAD_RESPONSE is always delivered to the CPU which was @@ -760,8 +760,11 @@ static void vmbus_wait_for_unload(void) * functional and vmbus_unload_response() will complete * vmbus_connection.unload_event. If not, the last thing we can do is * read message pages for all CPUs directly. + * + * Wait no more than 10 seconds so that the panic path can't get + * hung forever in case the response message isn't seen. */ - while (1) { + for (i = 0; i < 1000; i++) { if (completion_done(&vmbus_connection.unload_event)) break; -- 2.25.1