From: Michael Halcrow Subject: Re: [PATCH 12/12: eCryptfs] Crypto functions Date: Thu, 3 Nov 2005 18:14:09 -0600 Message-ID: <20051104001409.GB21628@halcrow.us> References: <20051103033220.GD2772@sshock.rn.byu.edu> <20051103035659.GL3005@sshock.rn.byu.edu> Reply-To: Michael Halcrow Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Phillip Hellewell , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, mike@halcrow.us, mhalcrow@us.ibm.com, mcthomps@us.ibm.com, yoder1@us.ibm.com Return-path: Received: from ylpvm15-ext.prodigy.net ([207.115.57.46]:27797 "EHLO ylpvm15.prodigy.net") by vger.kernel.org with ESMTP id S1030564AbVKDASQ (ORCPT ); Thu, 3 Nov 2005 19:18:16 -0500 Received: from pimout7-ext.prodigy.net (pimout7-int.prodigy.net [207.115.4.147]) by ylpvm15.prodigy.net (8.12.10 outbound/8.12.10) with ESMTP id jA40J4jZ014976 for ; Thu, 3 Nov 2005 19:19:04 -0500 To: James Morris Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Thu, Nov 03, 2005 at 07:08:46PM -0500, James Morris wrote: > > + if (likely(1 == crypt_stats->encrypted)) { > > + if (!crypt_stats->key_valid) { > > + ecryptfs_printk(1, KERN_NOTICE, "Key is " > > + "invalid; bailing out\n"); > > + rc = -EINVAL; > > + goto out; > > + } > > + } else { > > + rc = -EINVAL; > > + ecryptfs_printk(0, KERN_WARNING, > > + "Called with crypt_stats->encrypted == 0\n"); > > + goto out; > > + } > > What's going on here? Is (crypt_stats->encrypted != 1) a kernel > bug? If ecryptfs_write_headers() is ever called on an unencrypted file, then that is a programming error in eCryptfs. This will need to be replaced with a BUG_ON(). Mike