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: <c6ab6498-8094-b23e-0b93-c3bf1c866992@gmail.com>
Date:   Thu, 9 Feb 2017 10:22:52 -0800
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Arnd Bergmann <arnd@...db.de>,
        "David S . Miller" <davem@...emloft.net>
Cc:     netdev@...r.kernel.org, Jason Cooper <jason@...edaemon.net>,
        Andrew Lunn <andrew@...n.ch>,
        Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
        Gregory Clement <gregory.clement@...e-electrons.com>,
        Russell King <linux@...linux.org.uk>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [net-next] ARM: orion: fix PHYLIB dependency

On 02/09/2017 07:08 AM, Arnd Bergmann wrote:
> The newly introduced mdiobus_register_board_info() function is only available
> as part of PHYLIB, so we get a link error when we call that from a board while
> phylib is disabled:
> 
> arch/arm/plat-orion/common.o: In function `orion_ge00_switch_init':
> common.c:(.init.text+0x6a4): undefined reference to `mdiobus_register_board_info'

There is an empty stub provided in include/linux/phy.h when
CONFIG_PHYLIB is disabled, I am not clear why this did not work here?

I disabled CONFIG_NETDEVICES to force CONFIG_PHY not to be set here, and
I was not able to reproduce this, what am I missing?

> 
> This adds a workaround that is made up of three parts:
> 
> - in plat-orion, the function for declaring the switch is hidden without
>   PHYLIB.
> - in mach-orion5x, the caller conditionally stubs out the call to
>   the removed function, so we can still build other orion5x boards
>   without PHYLIB
> - For the boards that actually declare the switch, we select PHYLIB
>   explicitly from Kconfig if NETDEVICES is set. Without NETDEVICES,
>   we cannot enable PHYLIB, but we also wouldn't need it.
> 
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  arch/arm/mach-orion5x/Kconfig  | 5 +++++
>  arch/arm/mach-orion5x/common.c | 4 ++--
>  arch/arm/plat-orion/common.c   | 2 ++
>  3 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
> index 468b8cb7fd5f..b98a0057ef66 100644
> --- a/arch/arm/mach-orion5x/Kconfig
> +++ b/arch/arm/mach-orion5x/Kconfig
> @@ -107,6 +107,7 @@ config MACH_TS409
>  
>  config MACH_WRT350N_V2
>  	bool "Linksys WRT350N v2"
> +	select PHYLIB if NETDEVICES
>  	help
>  	  Say 'Y' here if you want your kernel to support the
>  	  Linksys WRT350N v2 platform.
> @@ -146,24 +147,28 @@ config MACH_MSS2_DT
>  
>  config MACH_WNR854T
>  	bool "Netgear WNR854T"
> +	select PHYLIB if NETDEVICES
>  	help
>  	  Say 'Y' here if you want your kernel to support the
>  	  Netgear WNR854T platform.
>  
>  config MACH_RD88F5181L_GE
>  	bool "Marvell Orion-VoIP GE Reference Design"
> +	select PHYLIB if NETDEVICES
>  	help
>  	  Say 'Y' here if you want your kernel to support the
>  	  Marvell Orion-VoIP GE (88F5181L) RD.
>  
>  config MACH_RD88F5181L_FXO
>  	bool "Marvell Orion-VoIP FXO Reference Design"
> +	select PHYLIB if NETDEVICES
>  	help
>  	  Say 'Y' here if you want your kernel to support the
>  	  Marvell Orion-VoIP FXO (88F5181L) RD.
>  
>  config MACH_RD88F6183AP_GE
>  	bool "Marvell Orion-1-90 AP GE Reference Design"
> +	select PHYLIB if NETDEVICES
>  	help
>  	  Say 'Y' here if you want your kernel to support the
>  	  Marvell Orion-1-90 (88F6183) AP GE RD.
> diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
> index 83a7ec4c16d0..e712c5adaf87 100644
> --- a/arch/arm/mach-orion5x/common.c
> +++ b/arch/arm/mach-orion5x/common.c
> @@ -107,10 +107,10 @@ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
>   ****************************************************************************/
>  void __init orion5x_eth_switch_init(struct dsa_chip_data *d)
>  {
> -	orion_ge00_switch_init(d);
> +	if (IS_BUILTIN(CONFIG_PHYLIB))
> +		orion_ge00_switch_init(d);
>  }
>  
> -
>  /*****************************************************************************
>   * I2C
>   ****************************************************************************/
> diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
> index 9255b6d67ba5..ab5af56f9b9d 100644
> --- a/arch/arm/plat-orion/common.c
> +++ b/arch/arm/plat-orion/common.c
> @@ -471,6 +471,7 @@ void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
>  /*****************************************************************************
>   * Ethernet switch
>   ****************************************************************************/
> +#if IS_BUILTIN(CONFIG_PHYLIB)
>  static __initconst const char *orion_ge00_mvmdio_bus_name = "orion-mii";
>  static __initdata struct mdio_board_info
>  		  orion_ge00_switch_board_info;
> @@ -493,6 +494,7 @@ void __init orion_ge00_switch_init(struct dsa_chip_data *d)
>  
>  	mdiobus_register_board_info(&orion_ge00_switch_board_info, 1);
>  }
> +#endif
>  
>  /*****************************************************************************
>   * I2C
> 


-- 
Florian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ