Received: by 10.192.165.148 with SMTP id m20csp2472745imm; Sun, 22 Apr 2018 07:46:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+yxzLhtco+004KEiHb9Cdc3s1HyN1H8jxZBW0YGD2KWXJThP6MVFj8q6vTPa/50i8PVxCV X-Received: by 10.99.113.20 with SMTP id m20mr14468558pgc.144.1524408376805; Sun, 22 Apr 2018 07:46:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524408376; cv=none; d=google.com; s=arc-20160816; b=v+X4jmdpiRVVAB3fX0z/3X3tctpc3MG0wAiI/e3i8/GnZNrFFTlhUBZXK6VkSEX1Qr h9Z0jONo7SxKH1B2s2yH50UDDYpHgzodZaSdBdzfPPm1twW4/es5vfpPp/B0CLwN4phP Dl9N4T4Iu0Rwt8VfwLRR7w22Kr5ltwUUTEfroWt0Uh0qlHCvr9FU64Unu1RLF3rCpwbM Er0x8WJ9y/YokDaMK3GPXvAs1UrvCrxc2zGVtb6uNFw1iC/8qE2sHCEcVFjDQjDfvRDt A4UZofUOqZeZkAPkjZDs7iX3E6JExFe0MxHBjiLHMO1eEWxibitLc+pTfSzAmQshEkVi 4uZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=TF2MttnB/sLlOKnmHuzVe7MDrMhqTkSOHU0Ypc33GI0=; b=wyOi37OFvyhlIaUJaTyEHfP7jl+kKCZNSekvJ6jqwM/Femph159BlDDDhezToUvLey Vxy7b0/iIOQQAHtHqaC7mfAPvZ0gNR9fDYjhpSYp2jH1AC7opE0geoHhY4l1pVIAR0Gw 96RSwY4uBoigwk4ZudCO3rT5Kj6Wp6w0GybFcbgW48/62LiLjWNRg2MZ7PnY9Vdj5/bT 9HLe3n6iNn++IPXfzgBwEdLiE6HDJ+9lFGNnCZZQ32OEd0dqsUtEnzvctZyWBJDFsssC KhprHQ0CQFWLlg9WnsdqCksv4QE2EpUOlYHOE5vapQeJQz2gsyfseRsSQ+HCC0QeYvJ4 hvag== ARC-Authentication-Results: i=1; mx.google.com; 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 a64-v6si8192509pla.530.2018.04.22.07.46.02; Sun, 22 Apr 2018 07:46:16 -0700 (PDT) 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; 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 S1757322AbeDVOo6 (ORCPT + 99 others); Sun, 22 Apr 2018 10:44:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57828 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932363AbeDVOQ4 (ORCPT ); Sun, 22 Apr 2018 10:16:56 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 190FDBA0; Sun, 22 Apr 2018 14:16:54 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Andryuk , Eduardo Otubo , Boris Ostrovsky , Juergen Gross Subject: [PATCH 4.4 33/97] xen-netfront: Fix hang on device removal Date: Sun, 22 Apr 2018 15:53:11 +0200 Message-Id: <20180422135307.198967865@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135304.577223025@linuxfoundation.org> References: <20180422135304.577223025@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jason Andryuk commit c2d2e6738a209f0f9dffa2dc8e7292fc45360d61 upstream. A toolstack may delete the vif frontend and backend xenstore entries while xen-netfront is in the removal code path. In that case, the checks for xenbus_read_driver_state would return XenbusStateUnknown, and xennet_remove would hang indefinitely. This hang prevents system shutdown. xennet_remove must be able to handle XenbusStateUnknown, and netback_changed must also wake up the wake_queue for that state as well. Fixes: 5b5971df3bc2 ("xen-netfront: remove warning when unloading module") Signed-off-by: Jason Andryuk Cc: Eduardo Otubo Reviewed-by: Boris Ostrovsky Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- drivers/net/xen-netfront.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -2024,7 +2024,10 @@ static void netback_changed(struct xenbu case XenbusStateInitialised: case XenbusStateReconfiguring: case XenbusStateReconfigured: + break; + case XenbusStateUnknown: + wake_up_all(&module_unload_q); break; case XenbusStateInitWait: @@ -2155,7 +2158,9 @@ static int xennet_remove(struct xenbus_d xenbus_switch_state(dev, XenbusStateClosing); wait_event(module_unload_q, xenbus_read_driver_state(dev->otherend) == - XenbusStateClosing); + XenbusStateClosing || + xenbus_read_driver_state(dev->otherend) == + XenbusStateUnknown); xenbus_switch_state(dev, XenbusStateClosed); wait_event(module_unload_q,