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: <20200714144007.GN1078057@lunn.ch>
Date:   Tue, 14 Jul 2020 16:40:07 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Marek BehĂșn <marek.behun@....cz>
Cc:     netdev@...r.kernel.org, Russell King <linux@...linux.org.uk>,
        "David S . Miller" <davem@...emloft.net>
Subject: Re: [PATCH net-next v1 1/2] net: mdiobus: add support to access PHY
 registers via debugfs

On Tue, Jul 14, 2020 at 04:22:12PM +0200, Marek BehĂșn wrote:
> This adds config option CONFIG_MDIO_BUS_DEBUGFS which, when enabled,
> adds support to communicate with the devices connected to the MDIO
> via debugfs.
> 
> For every MDIO bus this creates directory
>   /sys/kernel/debug/mdio_bus/MDIO_BUS_NAME
> with files "addr", "reg" and "val".
> User can write device address to the "addr" file and register number to
> the "reg" file, and then can read the value of the register from the
> "val" file, or can write new value by writing to the "val" file.
> 
> This is useful when debugging various PHYs or switches.

Hi Marek

Please work with Tobias Waldekranz <tobias@...dekranz.com>.

I'm not particularly keen on allowing write access to such registers,
but it seems like there is demand. But we don't want two ways to do
this.

>  static int mdiobus_register_gpiod(struct mdio_device *mdiodev)
>  {
> @@ -576,6 +577,12 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
>  		}
>  	}
>  
> +	err = mdiobus_register_debugfs(bus);
> +	if (err) {
> +		dev_err(&bus->dev, "mii_bus %s couldn't create debugfs entries\n", bus->id);
> +		goto error;
> +	}

FYI: You should never error out for debugfs. You should not even check
the return values from debugfs calls.

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ