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:   Wed, 18 Jan 2017 12:56:29 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Alison Schofield <amsfield22@...il.com>
Cc:     jic23@...nel.org, devel@...verdev.osuosl.org, lars@...afoo.de,
        Michael.Hennerich@...log.com, linux-iio@...r.kernel.org,
        gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
        pmeerw@...erw.net, knaack.h@....de
Subject: Re: [PATCH] iio: trigger: free trigger resource correctly

On Tue, Jan 17, 2017 at 07:00:28PM -0800, Alison Schofield wrote:
> Using iio_trigger_put() to free a trigger leads to release of
> a resource we never held.  Replace with iio_trigger_free().

They're basically the same except iio_trigger_put() puts the module and
the device and free only puts the device.

I've looked at this briefly, but I can't figure out how iio_trigger_get/
iio_trigger_put is supposed to be used.  There isn't any documentation.
I'm trying to review this code, but I can't figure out where we *are*
supposed to be doing the put.

For example, iio_device_unregister_trigger_consumer() takes a put, but
iio_device_register_trigger_consumer() doesn't do a get...  It's all
very confusing.

You seem like you know what's going on.  Can we get some documentation?

> 
> Signed-off-by: Alison Schofield <amsfield22@...il.com>
> ---
> Patches to use devm_* funcs are ready to follow this for
> the interrupt & bfin-timer triggers.
> 
>  drivers/iio/trigger/iio-trig-interrupt.c          | 4 ++--
>  drivers/iio/trigger/iio-trig-sysfs.c              | 2 +-
>  drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 4 ++--
>  3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/trigger/iio-trig-interrupt.c b/drivers/iio/trigger/iio-trig-interrupt.c
> index 572bc6f..b18e50d 100644
> --- a/drivers/iio/trigger/iio-trig-interrupt.c
> +++ b/drivers/iio/trigger/iio-trig-interrupt.c
> @@ -84,7 +84,7 @@ static int iio_interrupt_trigger_probe(struct platform_device *pdev)
>  error_free_trig_info:
>  	kfree(trig_info);
>  error_put_trigger:
> -	iio_trigger_put(trig);
> +	iio_trigger_free(trig);


We could rename this label.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ