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]
Date:	Mon, 16 Mar 2015 16:54:54 +0100
From:	Jonas Gorski <jogo@...nwrt.org>
To:	Maxime Bizon <mbizon@...ebox.fr>
Cc:	Nicolas Schichan <nschichan@...ebox.fr>,
	Ralf Baechle <ralf@...ux-mips.org>,
	MIPS Mailing List <linux-mips@...ux-mips.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Alexandre Courbot <acourbot@...dia.com>
Subject: Re: [PATCH] MIPS: bcm63xx: move bcm63xx_gpio_init() to bcm63xx_register_devices().

On Mon, Mar 16, 2015 at 3:53 PM, Maxime Bizon <mbizon@...ebox.fr> wrote:
>
> On Thu, 2015-03-12 at 17:00 +0100, Nicolas Schichan wrote:
>
>> When called from prom init code, bcm63xx_gpio_init() will fail as it
>> will call gpiochip_add() which relies on a working kmalloc() to alloc
>> the gpio_desc array and kmalloc is not useable yet at prom init time.
>>
>> Move bcm63xx_gpio_init() to bcm63xx_register_devices() (an
>> arch_initcall) where kmalloc works.
>
> no that patch is completely bogus:
>
> 1) bcm63xx_gpio_init() does more than registering the gpio_chip: look at
> bcm63xx_gpio_out_low_reg_init().
>
> We want at least the low lever helpers bcm_gpio_readl()/writel() to work
> early.

bcm_gpio_readl/bcm_gpio_writel() are completely unaffected by anything
done by bcm63xx_gpio_out_low_reg_init(), all they do is access the
gpio register space.

And all of the functions using the gpio_out_low_reg are static and
only accessible through the registered gpio chip, so there can't be
any rouge accesses before the chip is registered.

> 2) look at board_register_devices() in board_bcm963xx.c, it uses the
> gpio API, but is called during arch_initcall() (there was an attempt to
> move it later, but it has been reverted)
>
> so you cannot move that gpiochip registration later as-is, more
> refactoring and *testing* is required.

The only access done in board_register_devices() is the ephy-reset
gpio, and that is still done *after* moving bcm63xx_gpio_init() to
register_devices().

So I don't see how this breaks anything. But for the sake of the
argument, let's give it a spin:

root@...nWrt:/# uname -a
Linux OpenWrt 4.0.0-rc1+ #383 SMP Mon Mar 16 16:46:49 CET 2015 mips GNU/Linux
root@...nWrt:/# cat /sys/kernel/debug/gpio
GPIOs 0-39, bcm63xx-gpio:
 gpio-4   (power               ) out hi
 gpio-5   (stop                ) out lo
 gpio-15  (adsl-fail           ) out hi
 gpio-22  (ppp                 ) out hi
 gpio-23  (ppp-fail            ) out hi
 gpio-36  (ephy-reset          ) out hi

Everything seems to work fine.


Jonas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ