Skip to contentSkip to conversation

lockd: double unlock in next_host_state()

PATCH In review Dan Carpenter 2 participants 3 messages Jan 2, 2011 – Jan 3, 2011

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

PATCH 1/1 lockd: double unlock in next_host_state()

We unlock again after we goto out.

fs/lockd/host.c +0 -1
index c106d6a..5f1bcb2 100644
@@ -532,7 +532,6 @@ static struct nlm_host *next_host_state(struct hlist_head *cache,
 			host->h_state++;
 
 			nlm_get_host(host);
-			mutex_unlock(&nlm_host_mutex);
 			goto out;
 		}
 	}
#1 lore raw
Quoted 9 lines · Dan Carpenter

We unlock again after we goto out.

fs/lockd/host.c +0 -0
index c106d6a..5f1bcb2 100644

fs/lockd/host.c static struct nlm_host *next_host_state(struct hlist_head *cache, · line 537

Quoted 7 lines
fs/lockd/host.c +0 -1
@@ -532,7 +532,6 @@ static struct nlm_host *next_host_state(struct hlist_head *cache,
 			host->h_state++;
 
 			nlm_get_host(host);
-			mutex_unlock(&nlm_host_mutex);
 			goto out;
 		}
 	}

Would it also make sense to replace the "goto out;" with a "break;" ?

Signature · 2 lines
Chuck Lever
chuck[dot]lever[at]oracle[dot]com
#2 lore raw
Quoted 6 lines · Chuck Lever
Quoted 4 lines
fs/lockd/host.c +0 -1
-			mutex_unlock(&nlm_host_mutex);
			goto out;
		}
	}

Would it also make sense to replace the "goto out;" with a "break;" ?

No. for_each_host() is a nested for loop, so a break would only take you out of the inner most loop.

regards,
dan carpenter