Skip to contentSkip to conversation

CIFS: double unlock in cifs_lock_add_if()

PATCH In review Dan Carpenter 2 participants 2 messages Oct 29, 2011 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CIFS: double unlock in cifs_lock_add_if()

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

fs/cifs/file.c +3 -5
index ea096ce..b8dbab8 100644
@@ -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);

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

2011/10/29 Dan Carpenter <[email protected]>:

Quoted 25 lines

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

fs/cifs/file.c +3 -6
index ea096ce..b8dbab8 100644
@@ -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);
--
Quoted 4 lines

To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected]
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!

Signature · 6 lines
Best regards,
Pavel Shilovsky.
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html