Hi, ecryptfs maintainers.

I've found a problem on ecryptfs_calculate_md5 in fs/ecryptfs/crypto.c
on Linux 2.6.23.1.

http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.23.y.git;a=blob;f=fs/ecryptfs/crypto.c;h=6ac630625b70821274c4b8c753fbc90bc1daaec1;hb=4367388f04eea72e78347dc9b299698bf4275f92#l83

When IS_ERR(desc.tfm) is true, unlocking crypt_stat->cs_hash_tfm_mutex
is forgotten. And also I've added the error checking for crypto_hash_*
functions. please check.

Cheers.

-- 
=============================================
Kazuki Ohta <[EMAIL PROTECTED]>

Ishikawa Laboratory, Department of Information Science,
The University of Tokyo.

http://kzk9.net/
=============================================
--- linux-2.6.23.1.orig/fs/ecryptfs/crypto.c    2007-10-13 01:43:44.000000000 
+0900
+++ linux-2.6.23.1/fs/ecryptfs/crypto.c 2007-10-25 16:41:52.000000000 +0900
@@ -115,11 +115,14 @@ static int ecryptfs_calculate_md5(char *
                }
                crypt_stat->hash_tfm = desc.tfm;
        }
-       crypto_hash_init(&desc);
-       crypto_hash_update(&desc, &sg, len);
-       crypto_hash_final(&desc, dst);
-       mutex_unlock(&crypt_stat->cs_hash_tfm_mutex);
+       rc = crypto_hash_init(&desc);
+       if(rc) goto out;
+       rc = crypto_hash_update(&desc, &sg, len);
+       if(rc) goto out;
+       rc = crypto_hash_final(&desc, dst);
+       if(rc) goto out;
 out:
+       mutex_unlock(&crypt_stat->cs_hash_tfm_mutex);
        return rc;
 }
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
eCryptfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ecryptfs-devel

Reply via email to