]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ecryptfs/messaging.c
Merge commit 'origin' into devel
[linux-2.6-omap-h63xx.git] / fs / ecryptfs / messaging.c
index a9d87c47f72dfda1c047d736f68512e7cff028ba..9cc2aec27b0dc5b8de698dd8779b0cb4e70682b8 100644 (file)
@@ -419,13 +419,15 @@ int ecryptfs_init_messaging(unsigned int transport)
        }
        mutex_init(&ecryptfs_daemon_id_hash_mux);
        mutex_lock(&ecryptfs_daemon_id_hash_mux);
-       ecryptfs_hash_buckets = 0;
-       while (ecryptfs_number_of_users >> ++ecryptfs_hash_buckets);
+       ecryptfs_hash_buckets = 1;
+       while (ecryptfs_number_of_users >> ecryptfs_hash_buckets)
+               ecryptfs_hash_buckets++;
        ecryptfs_daemon_id_hash = kmalloc(sizeof(struct hlist_head)
                                          * ecryptfs_hash_buckets, GFP_KERNEL);
        if (!ecryptfs_daemon_id_hash) {
                rc = -ENOMEM;
                ecryptfs_printk(KERN_ERR, "Failed to allocate memory\n");
+               mutex_unlock(&ecryptfs_daemon_id_hash_mux);
                goto out;
        }
        for (i = 0; i < ecryptfs_hash_buckets; i++)