lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8d24c421-064c-9fee-577a-cbbf089cdf33@ti.com>
Date:   Wed, 3 Nov 2021 00:22:16 +0200
From:   Grygorii Strashko <grygorii.strashko@...com>
To:     Andrew Lunn <andrew@...n.ch>
CC:     "Russell King (Oracle)" <linux@...linux.org.uk>,
        "David S. Miller" <davem@...emloft.net>, <netdev@...r.kernel.org>,
        Jakub Kicinski <kuba@...nel.org>,
        Heiner Kallweit <hkallweit1@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        <linux-kernel@...r.kernel.org>,
        Vignesh Raghavendra <vigneshr@...com>
Subject: Re: [RFC PATCH] net: phy/mdio: enable mmd indirect access through
 phy_mii_ioctl()



On 02/11/2021 23:46, Andrew Lunn wrote:
>> @@ -300,8 +301,18 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
>>                          prtad = mii_data->phy_id;
>>                          devad = mii_data->reg_num;
>>                  }
>> -               mii_data->val_out = mdiobus_read(phydev->mdio.bus, prtad,
>> -                                                devad);
>> +
>> +               if (prtad != phydev->mdio.addr)
>> +                       phydev_rq = mdiobus_get_phy(phydev->mdio.bus, prtad);
>> +
>> +               if (!phydev_rq) {
>> +                       mii_data->val_out = mdiobus_read(phydev->mdio.bus, prtad, devad);
>> +               } else if (mdio_phy_id_is_c45(mii_data->phy_id) && !phydev->is_c45) {
>> +                       mii_data->val_out = phy_read_mmd(phydev_rq, mdio_phy_id_devad(mii_data->phy_id), mii_data->reg_num);
>> +               } else {
>> +                       mii_data->val_out = phy_read(phydev_rq, mii_data->reg_num);
>> +               }
>> +
> 
> One thing i don't like about this is you have little idea what it has
> actually done.
> 
> If you pass a C45 address, i expect a C45 access. If i pass a C22 i
> expect a C22 access.

I might be doing smth wrong and that's why it's RFC.
I wanted to understand if i hook into the kernel side first correctly, so
if above doesn't violate PHYs/mdiodev access any more there seems reason
try to continue.

> 
> What i find interesting is that you and the other resent requester are
> using the same user space tool. If you implement C45 over C22 in that
> tool, you get your solution, and it will work for older kernels as
> well. Also, given the diverse implementations of this IOTCL, it
> probably works for more drivers than just those using phy_mii_ioctl().

Do you mean change uapi, like
  add mdio_phy_id_is_c45_over_c22() and
  flag #define MDIO_PHY_ID_C45_OVER_C22 0x4000?

Thank you for your comments and patience.	

-- 
Best regards,
grygorii

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ