public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] CIFS: double unlock in cifs_lock_add_if()
@ 2011-10-29  7:18 Dan Carpenter
       [not found] ` <20111029071854.GA17780-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-10-29  7:18 UTC (permalink / raw)
  To: Steve French, Pavel Shilovsky
  Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

We unlocked "cinode->lock_mutex" twice so I've removed the first
unlock.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index ea096ce..b8dbab8 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -775,11 +775,9 @@ try_again:
 					(lock->blist.next = &lock->blist));
 		if (!rc)
 			goto try_again;
-		else {
-			mutex_lock(&cinode->lock_mutex);
-			list_del_init(&lock->blist);
-			mutex_unlock(&cinode->lock_mutex);
-		}
+
+		mutex_lock(&cinode->lock_mutex);
+		list_del_init(&lock->blist);
 	}
 
 	kfree(lock);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] CIFS: double unlock in cifs_lock_add_if()
       [not found] ` <20111029071854.GA17780-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
@ 2011-10-29  7:25   ` Pavel Shilovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Shilovsky @ 2011-10-29  7:25 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Steve French, linux-cifs-u79uwXL29TY76Z2rM5mHXA,
	samba-technical-w/Ol4Ecudpl8XjKLYN78aQ,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

2011/10/29 Dan Carpenter <dan.carpenter@oracle.com>:
> We unlocked "cinode->lock_mutex" twice so I've removed the first
> unlock.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index ea096ce..b8dbab8 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -775,11 +775,9 @@ try_again:
>                                        (lock->blist.next = &lock->blist));
>                if (!rc)
>                        goto try_again;
> -               else {
> -                       mutex_lock(&cinode->lock_mutex);
> -                       list_del_init(&lock->blist);
> -                       mutex_unlock(&cinode->lock_mutex);
> -               }
> +
> +               mutex_lock(&cinode->lock_mutex);
> +               list_del_init(&lock->blist);
>        }
>
>        kfree(lock);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

I recently posted the similar fix "CIFS: Remove extra mutex_unlock in
cifs_lock_add_if":
https://git.samba.org/sfrench/?p=sfrench/cifs-2.6.git;a=commitdiff;hÑ2799b4c3c4d1e65d7fdbb5d91538c92d6863dd;hpó62f98e7c445643d27c610bb7a86b79727b592e

Anyway, thanks for catching this!

-- 
Best regards,
Pavel Shilovsky.
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-29  7:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-29  7:18 [patch] CIFS: double unlock in cifs_lock_add_if() Dan Carpenter
     [not found] ` <20111029071854.GA17780-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>
2011-10-29  7:25   ` Pavel Shilovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox