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: <20140406202436.GA16739@core.coreip.homeip.net>
Date:	Sun, 6 Apr 2014 13:24:36 -0700
From:	Dmitry Torokhov <dmitry.torokhov@...il.com>
To:	Alexey Khoroshilov <khoroshilov@...ras.ru>
Cc:	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
	ldv-project@...uxtesting.org, Daniel Ribeiro <drwyrm@...il.com>,
	Ilya Petrov <ilya.muromec@...il.com>,
	Antonio Ospite <ospite@...denti.unina.it>
Subject: Re: [PATCH] input: pcap2: avoid calling mutex_lock() in irq handler

On Sun, Apr 06, 2014 at 12:54:50AM +0400, Alexey Khoroshilov wrote:
> pcap_keys_handler() calls ezx_pcap_read() that calls mutex_lock().
> pcap_keys_handler() is registered as nonthreaded irq handler,
> that means sleeping function is called in irq handler.
> 
> The patch makes a switch to threaded irq handling.
> Compile tested only.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@...ras.ru>
> ---
>  drivers/input/misc/pcap_keys.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/misc/pcap_keys.c b/drivers/input/misc/pcap_keys.c
> index cd230365166e..2a10f3a30969 100644
> --- a/drivers/input/misc/pcap_keys.c
> +++ b/drivers/input/misc/pcap_keys.c
> @@ -79,13 +79,15 @@ static int pcap_keys_probe(struct platform_device *pdev)
>  	if (err)
>  		goto fail_allocate;
>  
> -	err = request_irq(pcap_to_irq(pcap_keys->pcap, PCAP_IRQ_ONOFF),
> -			pcap_keys_handler, 0, "Power key", pcap_keys);
> +	err = request_threaded_irq(pcap_to_irq(pcap_keys->pcap, PCAP_IRQ_ONOFF),
> +				   NULL, pcap_keys_handler, 0,
> +				   "Power key", pcap_keys);
>  	if (err)
>  		goto fail_register;
>  
> -	err = request_irq(pcap_to_irq(pcap_keys->pcap, PCAP_IRQ_MIC),
> -			pcap_keys_handler, 0, "Headphone button", pcap_keys);
> +	err = request_threaded_irq(pcap_to_irq(pcap_keys->pcap, PCAP_IRQ_MIC),
> +				   NULL, pcap_keys_handler, 0,
> +				   "Headphone button", pcap_keys);

So I guess we do need threaded IRQ here, but I do not see the pcap's
irqchip specifying IRQCHIP_ONESHOT_SAFE so I do not think
request_threaded_irq() without IRQF_ONESHOT would succeed.

Can someone test the change to be sure?

Thanks!

-- 
Dmitry
--
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