Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2275433imb; Mon, 4 Mar 2019 00:29:05 -0800 (PST) X-Google-Smtp-Source: APXvYqyyJd+1VLRreSn7OqQkG8CoNOTy1DYLksEj+tGX7Q1nXolOSYeRfDjbaPyWyaEq9/kIFIuC X-Received: by 2002:a17:902:ba8c:: with SMTP id k12mr19471595pls.193.1551688145566; Mon, 04 Mar 2019 00:29:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551688145; cv=none; d=google.com; s=arc-20160816; b=au3mhcPDIEKQw22kE0/6eJEg9aObDERKgHVK6srosm4FZ7Go7tluuhDJ2+fUJE77oJ P4Iuc48LEZniFF+bXfAOZ7HAMHP+jmRwB8reNjVmFlYDxg5TE/9AX3+mxWwnsBTlPgMl LemUKHUu2L5dnlgotsp+5pENAikSW/uPBl97+9nQzHbMgONmk9na80+vHDyjtns1sIf4 8IboZHOJoZGbOZI9Mh+foRyNi31oNvMv0CnhkyKV5q01ETdZCctNEe5QidrD1l+CIbGB 7ycpAlf0IeV3XmNEr5qey+PohmOTQeuZlyFTLxq/VibF2UeBcrSJ3+fqQ+uHKXv8L95k PIFg== 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=dmIQflR12pS0R2ivtAd1myQi0VmnZjJAAJW8eXDykTU=; b=NRr5MsIdwERgTpt1f7wgODRXCH9cCHnilkGLMu0klVXJOfrv8ZNyIVqZE5dTgB0GCF KoC1M3vCXftVJCvHNZ+stxvMj87H5sxTObMB06HONsMcHQRt3dW2jKeBu/9sXIQelJvR xiM4vkAMy1ypeZpseM0hcxNABod+WdrdOKCEXgDrxuv3MWDebHa+ncDpkXg4SOJ6s4me GY5Q7Fe9APqJl5U//r8yWOHvsK+96DxJOpKaQHUNX7T2TJ4OhM2jC28WTFc3X2sDbIOs tbFuCs5q1eaB9bBvLWhVXacGlpDvERaXA359+h8yxSoArrmLLViHvgTaC+rl/RKQpXpb sBeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=V1jBApfA; 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 z8si4563456pgu.224.2019.03.04.00.28.50; Mon, 04 Mar 2019 00:29:05 -0800 (PST) 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=V1jBApfA; 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 S1726227AbfCDI0l (ORCPT + 99 others); Mon, 4 Mar 2019 03:26:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:48676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727117AbfCDI0h (ORCPT ); Mon, 4 Mar 2019 03:26:37 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 D8B26208E4; Mon, 4 Mar 2019 08:26:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551687997; bh=tUYBCvQ8NutiJYY8gAvZoQ3AhQL31W+jZ7TS+eJDYzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V1jBApfABqOgihtyTD6VAAoj+ncw890LqUKRlltTqQEMNvyDi8UXPViCxTPzEv8x/ 6LgYwv+PneoR+qWn5KD2IoYkU+AGPlgBSP0h/SWZ876eDQWtQIwqPramxZLLTomKkw /+4Wba/fVXOgbkmt3F/LuYU2UO0LU33s2AyIR708= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Run , Yang Wei , Marcel Ziswiler , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 36/52] net: usb: asix: ax88772_bind return error when hw_reset fail Date: Mon, 4 Mar 2019 09:22:34 +0100 Message-Id: <20190304081619.202542875@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190304081617.159014799@linuxfoundation.org> References: <20190304081617.159014799@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 6eea3527e68acc22483f4763c8682f223eb90029 ] The ax88772_bind() should return error code immediately when the PHY was not reset properly through ax88772a_hw_reset(). Otherwise, The asix_get_phyid() will block when get the PHY Identifier from the PHYSID1 MII registers through asix_mdio_read() due to the PHY isn't ready. Furthermore, it will produce a lot of error message cause system crash.As follows: asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to write reg index 0x0000: -71 asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to send software reset: ffffffb9 asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to write reg index 0x0000: -71 asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to enable software MII access asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to read reg index 0x0000: -71 asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to write reg index 0x0000: -71 asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to enable software MII access asix 1-1:1.0 (unnamed net_device) (uninitialized): Failed to read reg index 0x0000: -71 ... Signed-off-by: Zhang Run Reviewed-by: Yang Wei Tested-by: Marcel Ziswiler Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/usb/asix_devices.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index b1b3d8f7e67dd..d0c0ac0c3519c 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c @@ -731,8 +731,13 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0); chipcode &= AX_CHIPCODE_MASK; - (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) : - ax88772a_hw_reset(dev, 0); + ret = (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) : + ax88772a_hw_reset(dev, 0); + + if (ret < 0) { + netdev_dbg(dev->net, "Failed to reset AX88772: %d\n", ret); + return ret; + } /* Read PHYID register *AFTER* the PHY was reset properly */ phyid = asix_get_phyid(dev); -- 2.19.1