From patchwork Wed Nov 14 22:24:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 10683229 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1C1D713B5 for ; Wed, 14 Nov 2018 22:33:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DB692B9E2 for ; Wed, 14 Nov 2018 22:33:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 018F12B9E5; Wed, 14 Nov 2018 22:33:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97AEA2B9E2 for ; Wed, 14 Nov 2018 22:33:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387412AbeKOIai (ORCPT ); Thu, 15 Nov 2018 03:30:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:37724 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388853AbeKOIah (ORCPT ); Thu, 15 Nov 2018 03:30:37 -0500 Received: from sasha-vm.mshome.net (unknown [64.114.255.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0CA892252F; Wed, 14 Nov 2018 22:25:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542234333; bh=6rSZeZm2+N3gk2MuYFE+ZAbxz3kRRLER8M47SfOK/sQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CDTDxgat3EOezIftFnPo0qwcdvOk5fGLr0zQK0TXfAFYu/Z6qhaRLmah93dFll/LW HWp70kIi0Z1dxYPD0l7rkQA5VffIeL/Eb/I9UmNtNLjxTJnFeaQXv/6JdIy4nZ/Aax JqjkxSvUiCLZp/5VqVvGuMkCDUkvzKKv2+cJWaxw= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Frieder Schrempf , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 05/27] usbnet: smsc95xx: disable carrier check while suspending Date: Wed, 14 Nov 2018 17:24:54 -0500 Message-Id: <20181114222520.99926-5-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181114222520.99926-1-sashal@kernel.org> References: <20181114222520.99926-1-sashal@kernel.org> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Frieder Schrempf [ Upstream commit 7b900ead6cc66b2ee873cb042dfba169aa68b56c ] We need to make sure, that the carrier check polling is disabled while suspending. Otherwise we can end up with usbnet_read_cmd() being issued when only usbnet_read_cmd_nopm() is allowed. If this happens, read operations lock up. Fixes: d69d169493 ("usbnet: smsc95xx: fix link detection for disabled autonegotiation") Signed-off-by: Frieder Schrempf Reviewed-by: Raghuram Chary J Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/usb/smsc95xx.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 99e684e39d35..9b8afe4da73b 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -1598,6 +1598,8 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message) return ret; } + cancel_delayed_work_sync(&pdata->carrier_check); + if (pdata->suspend_flags) { netdev_warn(dev->net, "error during last resume\n"); pdata->suspend_flags = 0; @@ -1840,6 +1842,11 @@ static int smsc95xx_suspend(struct usb_interface *intf, pm_message_t message) */ if (ret && PMSG_IS_AUTO(message)) usbnet_resume(intf); + + if (ret) + schedule_delayed_work(&pdata->carrier_check, + CARRIER_CHECK_DELAY); + return ret; }