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: <20201129194918.GL2034289@dtor-ws>
Date:   Sun, 29 Nov 2020 11:49:18 -0800
From:   Dmitry Torokhov <dmitry.torokhov@...il.com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     rydberg@...omail.se, tj@...nel.org, linux-input@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] Input: Fix a ref counting issue

Hi Christophe,

On Sun, Nov 29, 2020 at 09:45:16AM +0100, Christophe JAILLET wrote:
> In case of a managed resource, 'devm_input_device_release()' already has a
> 'input_put_device(dev)' call.
> 
> Avoid a double reference decrement by explicitly calling
> 'input_put_device()' only on non-managed input device.

This patch is incorrect, as devres_destroy() that is used in
input_free_device(), unlike devres_releasde(), does not actually call
the "release" function. It simply destroys the devres object, but does
not clear associated resources.

> 
> Fixes: 2be975c6d920 ("Input: introduce managed input devices (add devres support)")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
> This patch is completely speculative and compile tested only.
> ---
>  drivers/input/input.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index 3cfd2c18eebd..c09c9f020667 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -1920,7 +1920,8 @@ void input_free_device(struct input_dev *dev)
>  						devm_input_device_release,
>  						devm_input_device_match,
>  						dev));
> -		input_put_device(dev);
> +		else
> +			input_put_device(dev);
>  	}
>  }
>  EXPORT_SYMBOL(input_free_device);
> -- 
> 2.27.0
> 

Thanks.

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ