提交 6ff374b0 编写于 作者: M Michael Walle 提交者: Zheng Zengkai

net: phy: mscc-miim: reject clause 45 register accesses

stable inclusion
from stable-v5.10.111
commit b7893388bb888cb15c7db0c0f71bd58a4fb5312c
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5GL1Z

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b7893388bb888cb15c7db0c0f71bd58a4fb5312c

--------------------------------

[ Upstream commit 8d90991e ]

The driver doesn't support clause 45 register access yet, but doesn't
check if the access is a c45 one either. This leads to spurious register
reads and writes. Add the check.

Fixes: 542671fe ("net: phy: mscc-miim: Add MDIO driver")
Signed-off-by: NMichael Walle <michael@walle.cc>
Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
上级 44f4d2d4
...@@ -76,6 +76,9 @@ static int mscc_miim_read(struct mii_bus *bus, int mii_id, int regnum) ...@@ -76,6 +76,9 @@ static int mscc_miim_read(struct mii_bus *bus, int mii_id, int regnum)
u32 val; u32 val;
int ret; int ret;
if (regnum & MII_ADDR_C45)
return -EOPNOTSUPP;
ret = mscc_miim_wait_pending(bus); ret = mscc_miim_wait_pending(bus);
if (ret) if (ret)
goto out; goto out;
...@@ -105,6 +108,9 @@ static int mscc_miim_write(struct mii_bus *bus, int mii_id, ...@@ -105,6 +108,9 @@ static int mscc_miim_write(struct mii_bus *bus, int mii_id,
struct mscc_miim_dev *miim = bus->priv; struct mscc_miim_dev *miim = bus->priv;
int ret; int ret;
if (regnum & MII_ADDR_C45)
return -EOPNOTSUPP;
ret = mscc_miim_wait_pending(bus); ret = mscc_miim_wait_pending(bus);
if (ret < 0) if (ret < 0)
goto out; goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册