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: <cbb40800-d01a-4e3b-bf36-6cfcb85b2796@moroto.mountain>
Date: Tue, 5 Mar 2024 17:14:33 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Charles Keepax <ckeepax@...nsource.cirrus.com>
Cc: linus.walleij@...aro.org, brgl@...ev.pl, linux-gpio@...r.kernel.org,
	linux-kernel@...r.kernel.org, patches@...nsource.cirrus.com
Subject: Re: [PATCH] gpio: swnode: Don't use __free() on result of
 swnode_get_gpio_device()

On Mon, Mar 04, 2024 at 04:03:20PM +0000, Charles Keepax wrote:
> swnode_get_gpio_device() can return an error pointer, however
> gpio_device_put() is not able to accept error values. Thus using
> __free() will result in dereferencing an invalid pointer.
> 

No, this code works as-is.  The gpio_device_put() won't be called
directly, it will be called by a wrapper that checks for error pointers.
The __free() stuff is defined like this:

include/linux/gpio/driver.h
   655  DEFINE_FREE(gpio_device_put, struct gpio_device *,
   656              if (!IS_ERR_OR_NULL(_T)) gpio_device_put(_T))

So it handles error pointers correctly.

regards,
dan carpenter


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ