From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758064AbcLBIM4 (ORCPT ); Fri, 2 Dec 2016 03:12:56 -0500 Received: from mail-pf0-f181.google.com ([209.85.192.181]:35799 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750750AbcLBIMy (ORCPT ); Fri, 2 Dec 2016 03:12:54 -0500 Date: Fri, 2 Dec 2016 00:12:49 -0800 From: Eric Biggers To: Richard Weinberger Cc: linux-mtd@lists.infradead.org, david@sigma-star.at, tytso@mit.edu, dedekind1@gmail.com, mhalcrow@google.com, adrian.hunter@intel.com, linux-kernel@vger.kernel.org, hch@infradead.org, linux-fsdevel@vger.kernel.org, jaegeuk@kernel.org, dengler@linutronix.de, sbabic@denx.de, wd@denx.de Subject: Re: [PATCH 2/6] fscrypt: Release fscrypt context on in-place encryption Message-ID: <20161202081249.GB18690@google.com> References: <1480630498-19201-1-git-send-email-richard@nod.at> <1480630498-19201-3-git-send-email-richard@nod.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1480630498-19201-3-git-send-email-richard@nod.at> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 01, 2016 at 11:14:54PM +0100, Richard Weinberger wrote: > From: David Gstir > > In case of in-place encryption ctx must be released right away. > Otherwise ctx is never freed. > I didn't notice this before, but the fscrypt_ctx isn't actually used at all in the "own pages" crypto case. So there's really no need to allocate one. How about we just handle the "own pages" case at the beginning of fscrypt_encrypt_page(): if (inode->i_sb->s_cop->flags & FS_CFLG_OWN_PAGES) { err = do_page_crypto(inode, FS_ENCRYPT, lblk_num, page, page, len, offs, gfp_flags); if (err) return ERR_PTR(err); return page; } (and the rest essentially the same as it used to be) Eric