Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3285573pxk; Mon, 21 Sep 2020 09:41:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyw36hLIoylw3d+vtzRe6ODVwqmUx+acTq5a0tkMbWCtM0l1TRsAngxvaz87Hi0VtilL/2I X-Received: by 2002:aa7:ce97:: with SMTP id y23mr566088edv.128.1600706515873; Mon, 21 Sep 2020 09:41:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600706515; cv=none; d=google.com; s=arc-20160816; b=lRErU5xGNF3FAn1PqHzWweuqO1ADuxn/rgkDCaVzixuoWj3TDsF/sjXpHIkL8+gthA bJXNXiJuQgznATInoDtaytQxb++oUPpYCO/KkwokkdfhRN/gjR5H7ovt7TJysgSo6pZD ZsXo9zQWPWCBOVJnKPjry1uon7u2o3U4h7oRnQxuA6kd2OtcotdvzTZc3wj9oZcv1wEQ bFUV0QTDd/cTY1C9VYwsjbyDUuPhEQzyWC7sqJLAlqXRmLo5xhJwIKXUYEvzg/4uPSo/ Wd+Z1r4Q7/qdx+b0AMYfsOhdS99TIEryg+bxQ87cwAvZoBeMvtcxmFhZPusFxQTH5+7e ah2g== 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=wVBSIT4JEPR+jG7VnywqSxPllOSkSmhR+UpU1Lc9cRs=; b=Da7Gq95dD/kwKlrZuFJ5nmr4vgCGAMdizADU1pVAKyUrP7Tq2yCONy6vCb9cSfuBaz Gwb++HzQAvZxcS2lhR4IohCsGL669+ibdmS4RviaN9lab1WJMyShqLeXqkaIFmKZk+Bl XDUI4Tx0eJL/TiiwFqH2ueOxXBzyFzLxiJK/+522UHJc8wkEqIjuMBQ7M2YNdY/sTyFW PlRkupOBJtUk+tpLOw1pIconk+ba2wAs0IruAlfe/k3xJpEN+KjxV9xIh5OjktEy0/j5 5Jl7+mjX0CUzTBfsMWUYmp2un4XN2bPhSxmRQFfBIL/FFwkhPZ10kiC1lpL89DT+VmHS hrAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MG655zLA; 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 a21si8211122eds.368.2020.09.21.09.41.32; Mon, 21 Sep 2020 09:41:55 -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=MG655zLA; 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 S1728788AbgIUQjt (ORCPT + 99 others); Mon, 21 Sep 2020 12:39:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:41952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728797AbgIUQjn (ORCPT ); Mon, 21 Sep 2020 12:39:43 -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 667C6238E6; Mon, 21 Sep 2020 16:39:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706382; bh=S94IViP3uOA7hn+c/uvNQhG2xCHnCJi1/+xBEnWvALo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MG655zLAF+NI6En9oCGbypVQVYLtjZUP14SSzgotNNgPKMjhHTQgSlAX5d3U9Pt5I lXEJ8uRgtHiSy9xUx/7WCPFC7pIlo3R8Y3xSsVTzQMN9tXjUdDiiO5PxnCUXs0xuX3 yo+iWNJIoE3DcEzg9H6MTmcP4ZqEEJhAYUrmuGEo= 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 4.14 77/94] Drivers: hv: vmbus: Add timeout to vmbus_wait_for_unload Date: Mon, 21 Sep 2020 18:28:04 +0200 Message-Id: <20200921162039.064901893@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162035.541285330@linuxfoundation.org> References: <20200921162035.541285330@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 462f7f363faab..5bf633c15cd4b 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -774,7 +774,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 @@ -784,8 +784,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