From patchwork Thu Oct 22 15:54:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Surbhi Palande X-Patchwork-Id: 36694 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id B95E7B7BB2 for ; Fri, 23 Oct 2009 02:54:48 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.60) (envelope-from ) id 1N0zzr-0006SU-PA; Thu, 22 Oct 2009 16:54:39 +0100 Received: from adelie.canonical.com ([91.189.90.139]) by chlorine.canonical.com with esmtp (Exim 4.60) (envelope-from ) id 1N0zzf-0006Pi-2b for kernel-team@lists.canonical.com; Thu, 22 Oct 2009 16:54:29 +0100 Received: from hutte.canonical.com ([91.189.90.181]) by adelie.canonical.com with esmtp (Exim 4.69 #1 (Debian)) id 1N0zze-0008H4-WD for ; Thu, 22 Oct 2009 16:54:27 +0100 Received: from adsl-070-155-203-163.sip.ard.bellsouth.net ([70.155.203.163] helo=canonical.com) by hutte.canonical.com with esmtpsa (TLS-1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1N0zze-0001ie-Cd for kernel-team@lists.canonical.com; Thu, 22 Oct 2009 16:54:26 +0100 From: Surbhi Palande To: kernel-team@lists.canonical.com Subject: Date: Thu, 22 Oct 2009 18:54:24 +0300 Message-Id: <1256226864-8117-1-git-send-email-surbhi.palande@canonical.com> X-Mailer: git-send-email 1.6.0.4 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.8 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com SRU Justification: Impact: Bug in the Ecryptfs disallowed saving the file under the ecryptfs directory ~/Private using Emacs. Fix: The cherry picked patch from the upstream commit id "b0105eaefa7cce8f4a941d0fc6354b250d30e745" fixed this bug. Previous to this fix a cipher code was not recognized and as a result memory was not allocated to some pointer. However this pointer was freed without allocation. This fix, prevents the freeing of memory when it is not recognised/allocated. Testcase: The reporter of the bug, has verified that this patch has fixed this bug for him. From d2504c185b312650445d95d2cfeac80309af237a Mon Sep 17 00:00:00 2001 From: Tyler Hicks Date: Tue, 11 Aug 2009 00:36:32 -0500 Subject: [PATCH] UBUNTU [Upstream]: eCryptfs: Handle unrecognized tag 3 cipher codes BugLink: https://bugs.launchpad.net/415252 Returns an error when an unrecognized cipher code is present in a tag 3 packet or an ecryptfs_crypt_stat cannot be initialized. Also sets an crypt_stat->tfm error pointer to NULL to ensure that it will not be incorrectly freed in ecryptfs_destroy_crypt_stat(). Acked-by: Serge Hallyn Cc: ecryptfs-devel@lists.launchpad.net Cc: stable Signed-off-by: Tyler Hicks (cherry picked from commit b0105eaefa7cce8f4a941d0fc6354b250d30e745) Signed-off-by: Surbhi Palande --- fs/ecryptfs/crypto.c | 1 + fs/ecryptfs/keystore.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 8b65f28..bbf080b 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c @@ -814,6 +814,7 @@ int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat) kfree(full_alg_name); if (IS_ERR(crypt_stat->tfm)) { rc = PTR_ERR(crypt_stat->tfm); + crypt_stat->tfm = NULL; ecryptfs_printk(KERN_ERR, "cryptfs: init_crypt_ctx(): " "Error initializing cipher [%s]\n", crypt_stat->cipher); diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c index 37bcb43..b41af15 100644 --- a/fs/ecryptfs/keystore.c +++ b/fs/ecryptfs/keystore.c @@ -1317,8 +1317,10 @@ parse_tag_3_packet(struct ecryptfs_crypt_stat *crypt_stat, rc = -EINVAL; goto out_free; } - ecryptfs_cipher_code_to_string(crypt_stat->cipher, - (u16)data[(*packet_size)]); + rc = ecryptfs_cipher_code_to_string(crypt_stat->cipher, + (u16)data[(*packet_size)]); + if (rc) + goto out_free; /* A little extra work to differentiate among the AES key * sizes; see RFC2440 */ switch(data[(*packet_size)++]) { @@ -1329,7 +1331,9 @@ parse_tag_3_packet(struct ecryptfs_crypt_stat *crypt_stat, crypt_stat->key_size = (*new_auth_tok)->session_key.encrypted_key_size; } - ecryptfs_init_crypt_ctx(crypt_stat); + rc = ecryptfs_init_crypt_ctx(crypt_stat); + if (rc) + goto out_free; if (unlikely(data[(*packet_size)++] != 0x03)) { printk(KERN_WARNING "Only S2K ID 3 is currently supported\n"); rc = -ENOSYS;