diff --git a/kernel/futex.c b/kernel/futex.c
index 2331b73f69323a5d59873d8613e6dadeafcbff51..6b50a024bca22e32b0a606fb4b7ea6daf1525967 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -659,7 +659,8 @@ static inline void
 double_unlock_hb(struct futex_hash_bucket *hb1, struct futex_hash_bucket *hb2)
 {
 	spin_unlock(&hb1->lock);
-	spin_unlock(&hb2->lock);
+	if (hb1 != hb2)
+		spin_unlock(&hb2->lock);
 }
 
 /*