Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4618463pxj; Wed, 12 May 2021 09:21:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXh2QX8CFjLiQvKVY9apPRV61zBUSC3lZeRBe88hjrIokZjqFdf6yhSgaqjtkMBfRjKsAP X-Received: by 2002:a17:906:d9c3:: with SMTP id qk3mr37999170ejb.376.1620836470344; Wed, 12 May 2021 09:21:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836470; cv=none; d=google.com; s=arc-20160816; b=AUNHhQRPs2nmz+gqnyWOzuSJINnWjlj7RcBZ/xVVuQKgEoYKNftqsMUaK3o8D6xJOs aPWLdDhNSAQdN25NhSrAqTuzSE2EPxxx0hMlC3R7vCbUc+4/Fy51ltr4V2+/lc032rqA WU5YT0XyzNB6/mIiEVCKGFSZekDNzYQAFi3zSOhCvT2qUnmUJzgB4VyEG1suR0MTTJsd uLQU33/5lKon8FfKPG3B613cc8z6iSS0eCjl+r13AnlSIY4K8cb8bt95yEmJhLCm4bY/ Ix99ZoFWgTellPo/AGZgSbx3SxKJ8+HSpol/DTz8dO8MErQGerWWYgkcy6iO5yGeHu9l xx9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=O924cpXVWjkQCObdHrmk8jagrmxxzVuLbESgcGiBptM=; b=lcczfUhKXkhHO7RK8XaM88CirQElsFxw+/pHzYxyHHIiF6oXTCnXDNKnD3gvKMo2O6 UjsV8lU8PY70msQCVeGpQMXS57YXfi9M7k9sZBNinzRYiQqYEGFwWdACM63vLTGc6Tjl 3SLqcXcUQ8hOksIsZnOcaZTxYenWnYHSagFq7A8/mkInTYyui6+dgb2RHfaFG6UW+KAx +1uXgxfM11FneLjB9EUXHntFBf0Becv+j/lfZ6mpgDuDiyqVMBtXEupqxfkr95ZT3TgU XIRvN5GyP1qcPlCg+1ZEH1wDqKbuCKm+KoSmbAx0BEh8Rtqq5ZWERyjovlZ1eJ8jNd/q fzQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Mf5Xscm1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w1si379028ejq.335.2021.05.12.09.20.45; Wed, 12 May 2021 09:21:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Mf5Xscm1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240708AbhELQSy (ORCPT + 99 others); Wed, 12 May 2021 12:18:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:50090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235554AbhELPf4 (ORCPT ); Wed, 12 May 2021 11:35:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B845961C43; Wed, 12 May 2021 15:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832678; bh=V7B4Wi4Gqt+hVdPTZ8oV/auGEclNsH/Hpn+n/5MwV/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mf5Xscm1l9CNW46iXdLsWsXUCqfOiywbRNsM34AqFA1iXnyhKJei1CFgKx+Bc4EFu +2n12nHyN2XKPTZe+g0A5CoDJsTAM4bS3fjGPNI7t7N1LQ+vAm36LvdXTC+6uovDYQ 5fiAEKFH/q7UTNInJ5SbPHSo8rIhATvXUorZvdFU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?M=C3=A5ns=20Rullg=C3=A5rd?= , Andre Edich , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 379/530] net: phy: lan87xx: fix access to wrong register of LAN87xx Date: Wed, 12 May 2021 16:48:09 +0200 Message-Id: <20210512144832.233547667@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andre Edich [ Upstream commit fdb5cc6ab3b6a1c0122d3644a63ef9dc7a610d35 ] The function lan87xx_config_aneg_ext was introduced to configure LAN95xxA but as well writes to undocumented register of LAN87xx. This fix prevents that access. The function lan87xx_config_aneg_ext gets more suitable for the new behavior name. Reported-by: Måns Rullgård Fixes: 05b35e7eb9a1 ("smsc95xx: add phylib support") Signed-off-by: Andre Edich Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/phy/smsc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 10722fed666d..caf7291ffaf8 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -152,10 +152,13 @@ static int lan87xx_config_aneg(struct phy_device *phydev) return genphy_config_aneg(phydev); } -static int lan87xx_config_aneg_ext(struct phy_device *phydev) +static int lan95xx_config_aneg_ext(struct phy_device *phydev) { int rc; + if (phydev->phy_id != 0x0007c0f0) /* not (LAN9500A or LAN9505A) */ + return lan87xx_config_aneg(phydev); + /* Extend Manual AutoMDIX timer */ rc = phy_read(phydev, PHY_EDPD_CONFIG); if (rc < 0) @@ -408,7 +411,7 @@ static struct phy_driver smsc_phy_driver[] = { .read_status = lan87xx_read_status, .config_init = smsc_phy_config_init, .soft_reset = smsc_phy_reset, - .config_aneg = lan87xx_config_aneg_ext, + .config_aneg = lan95xx_config_aneg_ext, /* IRQ related */ .ack_interrupt = smsc_phy_ack_interrupt, -- 2.30.2