Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp839041ybi; Fri, 12 Jul 2019 05:30:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+ZYF4Vt+Ia4uF+AhX1Q+2qv73ozb2oLcJ6tO/XtdPhVNmAnbfgfoocrex9UDKNYbsIrro X-Received: by 2002:a17:90a:d814:: with SMTP id a20mr11568050pjv.48.1562934633625; Fri, 12 Jul 2019 05:30:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562934633; cv=none; d=google.com; s=arc-20160816; b=Jtw5by1LD2Z9dj6hQfX+NjOnDQGte2eJoxTA8fl93gQbe/76cPa/lZxrDncpT8V1hp AWrOFwHD4wSQXcKHfVNmN3VecntFAp24VzVrslhPVxRRwoHcsRTQkFPLtguHDcQ1G5+l eBdvnwhkYkl2URtpM2c5VKtu0esFcRiE1t60CiC8qSvMntkdlifuD9ZdUFNYhQJ8Ijdl srzBb7lXdWeUmt0I5jBPVIGBMZn+IG++gFkgmla0MP/sZU/ZJaQyogP82dDcliBmi7TN 8ZmXD7SeeqB07gKyEKxd7tT1FMHWSWuvWc8AallERg1HLRRVMAxnUFFItIYccWXt9TOM KG4Q== 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=2X5BHfwoiCjadcXbQws7y1W4ZJt759zDaZ82v4daDFc=; b=Y0KIbqQY02IPzLh+KkOJfUvNXWrJp/XU+jD1k93BQdopkxxnjlQUXMWBpBA6H5u965 CPFr3icxNZySXAjTBtuwYKNShR7tQ8E5Vq/ILqrVXQ9mjPHQmbZZOo+xoo4pVWaWtjgK TwhojSfLYLyaEQiojX9blDj8A7PZjXOMwHcwO9bYEHPA13ttX1nrE0P9iW3mZjF3LlEs wwpk5s4I78XR4rnxl2dY41C0S0Vx+myPQ2czJlzNIqHemxKrtg3mDe/dUUV4HaXc59qF 4UMneaYafkPUscZCgH2dnFqZo3MuBwfkmkI7iz8cRz09+Xci5TVrqt73srHd2jRNz0GH 3glg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HMayZfph; 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 g11si7979526plm.390.2019.07.12.05.30.18; Fri, 12 Jul 2019 05:30:33 -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; dkim=pass header.i=@kernel.org header.s=default header.b=HMayZfph; 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 S1728755AbfGLM2K (ORCPT + 99 others); Fri, 12 Jul 2019 08:28:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:41592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728747AbfGLM2I (ORCPT ); Fri, 12 Jul 2019 08:28:08 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 583D4208E4; Fri, 12 Jul 2019 12:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934487; bh=VsZms4Ebu41p9h8mUbbIv4O/kyaymEWAYms16wI9iH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HMayZfphThhVfXcm2N0ZL1U7NdsMzYvyLT8L+5ySlN8+BuzKFHh9Bu9EJXIR+4n2m rCRwBFSRyf83516cNB7nvuMMF4PWGVQfeAQMwMnVniDHYyI0khWRkRElSI5dg+r53T JbtAN3S6iy17E0Jzav5A1wZFB7gO9tuSeadBcMpw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniele Palmas , Reinhard Speyerer , "David S. Miller" , Sasha Levin Subject: [PATCH 5.1 069/138] qmi_wwan: avoid RCU stalls on device disconnect when in QMAP mode Date: Fri, 12 Jul 2019 14:18:53 +0200 Message-Id: <20190712121631.315837239@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit a8fdde1cb830e560208af42b6c10750137f53eb3 ] Switch qmimux_unregister_device() and qmi_wwan_disconnect() to use unregister_netdevice_queue() and unregister_netdevice_many() instead of unregister_netdevice(). This avoids RCU stalls which have been observed on device disconnect in certain setups otherwise. Fixes: c6adf77953bc ("net: usb: qmi_wwan: add qmap mux protocol support") Cc: Daniele Palmas Signed-off-by: Reinhard Speyerer Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/usb/qmi_wwan.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 090227118d3d..44ada5c38756 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -247,13 +247,14 @@ static int qmimux_register_device(struct net_device *real_dev, u8 mux_id) return err; } -static void qmimux_unregister_device(struct net_device *dev) +static void qmimux_unregister_device(struct net_device *dev, + struct list_head *head) { struct qmimux_priv *priv = netdev_priv(dev); struct net_device *real_dev = priv->real_dev; netdev_upper_dev_unlink(real_dev, dev); - unregister_netdevice(dev); + unregister_netdevice_queue(dev, head); /* Get rid of the reference to real_dev */ dev_put(real_dev); @@ -424,7 +425,7 @@ static ssize_t del_mux_store(struct device *d, struct device_attribute *attr, c ret = -EINVAL; goto err; } - qmimux_unregister_device(del_dev); + qmimux_unregister_device(del_dev, NULL); if (!qmimux_has_slaves(dev)) info->flags &= ~QMI_WWAN_FLAG_MUX; @@ -1434,6 +1435,7 @@ static void qmi_wwan_disconnect(struct usb_interface *intf) struct qmi_wwan_state *info; struct list_head *iter; struct net_device *ldev; + LIST_HEAD(list); /* called twice if separate control and data intf */ if (!dev) @@ -1446,8 +1448,9 @@ static void qmi_wwan_disconnect(struct usb_interface *intf) } rcu_read_lock(); netdev_for_each_upper_dev_rcu(dev->net, ldev, iter) - qmimux_unregister_device(ldev); + qmimux_unregister_device(ldev, &list); rcu_read_unlock(); + unregister_netdevice_many(&list); rtnl_unlock(); info->flags &= ~QMI_WWAN_FLAG_MUX; } -- 2.20.1