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: <alpine.LNX.2.00.1006211202550.13809@pobox.suse.cz>
Date:	Mon, 21 Jun 2010 12:03:11 +0200 (CEST)
From:	Jiri Kosina <jkosina@...e.cz>
To:	Julia Lawall <julia@...u.dk>
Cc:	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 1/2] drivers/hid: Eliminate a double lock

On Sun, 20 Jun 2010, Julia Lawall wrote:

> From: Julia Lawall <julia@...u.dk>
> 
> The path around the loop ends with the lock held, so the call to mutex_lock
> is moved before the beginning of the loop.
> 
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
[ ... ]
> diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
> index c940267..850d02a 100644
> --- a/drivers/hid/hid-debug.c
> +++ b/drivers/hid/hid-debug.c
> @@ -949,8 +949,8 @@ static ssize_t hid_debug_events_read(struct file *file, char __user *buffer,
>  	int ret = 0, len;
>  	DECLARE_WAITQUEUE(wait, current);
>  
> +	mutex_lock(&list->read_mutex);
>  	while (ret == 0) {
> -		mutex_lock(&list->read_mutex);
>  		if (list->head == list->tail) {
>  			add_wait_queue(&list->hdev->debug_wait, &wait);
>  			set_current_state(TASK_INTERRUPTIBLE);

Applied, thanks Julia.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.
--
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