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] [day] [month] [year] [list]
Message-ID: <CAAVeFu+=D8PJwTUMmaA-PWR5SbBfzQPpdZhtychxZNft6SvmDA@mail.gmail.com>
Date:	Wed, 19 Mar 2014 17:37:42 +0900
From:	Alexandre Courbot <gnurou@...il.com>
To:	Ben Dooks <ben.dooks@...ethink.co.uk>
Cc:	linux-kernel@...ts.codethink.co.uk,
	Linus Walleij <linus.walleij@...aro.org>,
	"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpiolib: check if gpio_desc pointer is error or NULL

On Wed, Mar 19, 2014 at 5:33 PM, Ben Dooks <ben.dooks@...ethink.co.uk> wrote:
> On 19/03/14 02:48, Alexandre Courbot wrote:
>>
>> On Tue, Mar 18, 2014 at 7:41 PM, Ben Dooks <ben.dooks@...ethink.co.uk>
>> wrote:
>>>
>>> Some of the gpiod_ calls take a pointer to a gpio_desc as their
>>> argument but only check to see if it is NULL to validate the
>>> input.
>>>
>>> Calls such as devm_gpiod_get() return an error-pointer if they
>>> fail, so doing the following will not work:
>>>
>>>          gpio = devm_gpiod_get(...);
>>>          gpiod_direction_output(gpio, 0);
>>>
>>> The sequence produces an OOPS like:
>>>
>>>          Unable to handle kernel paging request at virtual address
>>> fffffffe
>>>
>>> Change all calls that check for !desc to use IS_ERR_OR_NULL() to
>>> avoid these issues.
>>
>>
>> This change is certainly correct from a semantics point of view. Maybe
>> I'd argue that the burden is on the caller to check that gpiod_get()
>> returns a valid GPIO descriptor, but having extra security doesn't
>> hurt. However my problem with this change in its current form is that
>> it will hide such forgetfulnesses by making functions like
>> gpiod_get_value() fail silently instead of triggering a oops.
>
>
> On the other hand, it means that we do not have to keep checking
> the validity of the pointer in the caller.

A very scary perspective which I don't think we should support.
Especially since the pointer only needs to be checked once, after
gpiod_get() is called.
--
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