Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3299824pxk; Mon, 21 Sep 2020 10:02:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpktZfa1PgH4VH8zPquZen35GEc5T3YJO0G7WrX/zWMgCCPSUKsK4KHOS7b7MpprnhDqDN X-Received: by 2002:a17:906:850e:: with SMTP id i14mr424671ejx.168.1600707767668; Mon, 21 Sep 2020 10:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600707767; cv=none; d=google.com; s=arc-20160816; b=kWGqYTwakEA/zSmnBSYBfwOf++5XtZO6jo9LH0YAjuKsuANCxdojhvATel2ZukKXxV BEpsQ8K3LPF0EBdOhPOxbQ/2RTY2aN1nJq9/bVAJNtwTf732MsgYtofCtR0848v2JDIf CMZBcC415fgCjg7LhOW20fAwjcPpwXA0tismeakJreARPOXKM+WiRDEahnLsEj7RRPNx DCpq5RsoS5sSf24tOCViP8ysMrSK2dcJIXr4jBVqLbZrURRVQd7dsF/XuJhY3XybKLby B0dOv7pOg87W8+rxy+6GFhyhTWVNNrlkkkolzm6EWoz+Cne+gtYGuaP5r/+dL+hfqPk2 QDRQ== 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=UzTBLBHnjHamjuH1ynVCwjC0wlTjUc8qxQFNIEg3kCE=; b=tMWglWu5OrR0qJHCx8uR/jwrBAGuEk8DLcD6scm87OQjvt2fRQIPbXPQdaL+Fuz2EM nNSedKEJPX3Z9lcGxnjZPNTllJjkOl2zYwYt2DsGm1oZfj/4oBMbp/j70juEIbUsbG9n XKwt/KBMj4rM1aKU4FKBF5R4XvL5WQPND+Vn8BTeQ/gzFls4A/n3Wvnm7DrGOCYcWrEK JPe3urohhYYTkXsLNl84SArCrEp1FepFDpNwLMKqrOt9DHzy3oV28ukKvlEug4KfPhHQ jpttPoxX0w5rmT898vdRd9/Vi2EmiN1M8baNehElcUw6XTe8S/5Ag1VGmOacGEtoAroj k/rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BU+Gwhc8; 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 p2si8618857ejw.176.2020.09.21.10.02.21; Mon, 21 Sep 2020 10:02:47 -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=BU+Gwhc8; 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 S1727980AbgIUQ7L (ORCPT + 99 others); Mon, 21 Sep 2020 12:59:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:45346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729452AbgIUQlk (ORCPT ); Mon, 21 Sep 2020 12:41:40 -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 01DEA239D1; Mon, 21 Sep 2020 16:41:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706497; bh=jOyl2Vi+KW94KMUqGZnGm+CTIEjrmMZWVNXSJ0OfgEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BU+Gwhc8gc/Au7WBmITSpBzobGcF2FA3K9CNnraFizuJV6lhGM2hJImtwGLU14uSZ q/vOx4lJFJgQZU+WXtfC5A02P09Rip5hIm4P/ZSTdR8yc3TWJOgwRsZBTUyXMc57aP guDbn5GAtxOBcJApJiLCvDqaKivsSpGobiGLAtr0= 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.19 29/49] Drivers: hv: vmbus: Add timeout to vmbus_wait_for_unload Date: Mon, 21 Sep 2020 18:28:13 +0200 Message-Id: <20200921162035.937037969@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162034.660953761@linuxfoundation.org> References: <20200921162034.660953761@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 c83361a8e2033..7920b0d7e35a7 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -779,7 +779,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 @@ -789,8 +789,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