Re: [bug report] net: mdio: Add dedicated C45 API to MDIO bus drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 17, 2023 at 05:18:19PM +0300, Dan Carpenter wrote:
> Hello Andrew Lunn,

Adding Florian

> The patch 4e4aafcddbbf: "net: mdio: Add dedicated C45 API to MDIO bus
> drivers" from Jan 9, 2023, leads to the following Smatch static
> checker warning:
> 
> drivers/net/phy/mdio_bus.c:1003 mdiobus_c45_read() warn: sleeping in atomic context
> drivers/net/phy/mdio_bus.c:1104 mdiobus_c45_write() warn: sleeping in atomic context
> 
> drivers/net/phy/mdio_bus.c
>     993  * @regnum: register number to read
>     994  *
>     995  * NOTE: MUST NOT be called from interrupt context,
>     996  * because the bus read/write functions may wait for an interrupt
>     997  * to conclude the operation.
>     998  */
>     999 int mdiobus_c45_read(struct mii_bus *bus, int addr, int devad, u32 regnum)
>     1000 {
>     1001         int retval;
>     1002 
> --> 1003         mutex_lock(&bus->mdio_lock);
>                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> This takes a mutex.
> 
>     1004         retval = __mdiobus_c45_read(bus, addr, devad, regnum);
>     1005         mutex_unlock(&bus->mdio_lock);
>     1006 
>     1007         return retval;
>     1008 }
> 
> The problematic call tree is:
> 
> b44_ioctl() <- disables preempt
> -> phy_mii_ioctl()
>    -> mdiobus_c45_read()

This seems like an old bug which my change has brought to light. I
believe MDIO operations have always been blocking. So i would say
b44_ioctl should not be taking a spinlock here.

	  Andrew



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux