Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp175749imd; Wed, 31 Oct 2018 16:50:43 -0700 (PDT) X-Google-Smtp-Source: AJdET5etY/XhQfDkG7VTywLBbctIUk/XuncegEQyshls2FDfbvSTUM/aj7Gw49YVnInZnvFvNjzC X-Received: by 2002:a63:f55:: with SMTP id 21-v6mr5074863pgp.100.1541029843144; Wed, 31 Oct 2018 16:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029843; cv=none; d=google.com; s=arc-20160816; b=zLgMqUYseDp0nXxXOUSG15n9/h4RvSIKkPs4/7g6rgWHo4BLtoPxxr6t5dQlowrCmc Jur8H4jFK127ge0jDKKlm+n0uO0iK3egbsc0aSq8xx3zgRXmYo+lUz3gtJzbRjidiIT6 qjgTkH89ZoSU2E5NMVBCioVdtaTpsBg6h0QkaT8WP8zzAjHCsKFjMXLFiHraH/Ii93nr NU/YLi/6NXWtwTA2q89WOChB5zXxIYVFnUlXFBPp1s07ASat88/9ivW5bb7aM2Qk5sGZ LETR59WgJnP/WpzSmA1tgP2kvnlK3kh0H3r65NjtfU1y938lbpeMumig3woVu98be+UC WpFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=bs+S6mGKIQ5kg9796m3tbnJ1CBWLb6q0Az3mmbpDq1Q=; b=a+vq4729J37T5KqE/ug4Ib8CTkGgmJzXl/V4ZiwQXMDWs4J3YcawDKg1HwtFxVPYf/ KVh+cREoLAybknmTGd1LWWfglC3m6iPIOOxeumCAUlEE69AYADLkHXR/TJYiDz6iEVAx x2yfeTiRQ6mBdO5s+4h+Ne5pW7DW/pFhJV0ZHUar7ayLc+yuITM051s+fzy/1hM5aXUa G6W5DJRDqYs4KGn7V21mcz6rLaymt2wcmRuTkTil8L3ZEod1ssKUsqYV5pSU/VbsirPl E5pLvTKnfx7+J+HdsJGqHz7WdOIFvYMV+rtyBCed72BLOSlVbg0pYdNBAZwChrdzhanB nR0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="bs5y/61i"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11-v6si4407894plg.300.2018.10.31.16.50.27; Wed, 31 Oct 2018 16:50:43 -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="bs5y/61i"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728301AbeKAIGo (ORCPT + 99 others); Thu, 1 Nov 2018 04:06:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:53866 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728257AbeKAIGo (ORCPT ); Thu, 1 Nov 2018 04:06:44 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (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 7CAA120823; Wed, 31 Oct 2018 23:06:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027194; bh=SwNqTUe1SYr4vk7M4QJl4eJyUKvg5rIEjdbXI9H00zo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bs5y/61igbPWJJxMhVaeNqBF9hW/FH4kbnIBRZaxq4G9cfRXZqy3gx+66yW8yg/cc Q20xRw97QGDsj1d0oo/bhHfXH8Zw+ttGVMGghwTEyKA5m/EmEtNOkJRzonSYvXjTF4 QsgeyLCfHjuSOUYhVa2GhD/bOKFhAcFg575wm6vE= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Antoine Tenart , "David S . Miller" , Sasha Levin Subject: [PATCH AUTOSEL 4.19 057/146] net: phy: phylink: ensure the carrier is off when starting phylink Date: Wed, 31 Oct 2018 19:04:12 -0400 Message-Id: <20181031230541.28822-57-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Antoine Tenart [ Upstream commit aeeb2e8fdefdd5d257a1446351c70cb3df540199 ] Phylink made an assumption about the carrier state being down when calling phylink_start(). If this assumption isn't satisfied, the internal phylink state could misbehave and a net device could end up not being functional. This patch fixes this by explicitly calling netif_carrier_off() in phylink_start(). Signed-off-by: Antoine Tenart Acked-by: Russell King Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/phy/phylink.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 7abca86c3aa9..70f3f90c2ed6 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -907,6 +907,9 @@ void phylink_start(struct phylink *pl) phylink_an_mode_str(pl->link_an_mode), phy_modes(pl->link_config.interface)); + /* Always set the carrier off */ + netif_carrier_off(pl->netdev); + /* Apply the link configuration to the MAC when starting. This allows * a fixed-link to start with the correct parameters, and also * ensures that we set the appropriate advertisement for Serdes links. -- 2.17.1