Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934991AbcJUSaU (ORCPT ); Fri, 21 Oct 2016 14:30:20 -0400 Received: from mail-pf0-f178.google.com ([209.85.192.178]:35103 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933350AbcJUSaQ (ORCPT ); Fri, 21 Oct 2016 14:30:16 -0400 Date: Fri, 21 Oct 2016 11:30:12 -0700 From: Eric Biggers To: Richard Weinberger Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, dedekind1@gmail.com, adrian.hunter@intel.com, tytso@mit.edu, jaegeuk@kernel.org, david@sigma-star.at, wd@denx.de, sbabic@denx.de, dengler@linutronix.de Subject: Re: [PATCH 25/26] ubifs: Implement UBIFS_FLG_ENCRYPTION Message-ID: <20161021183012.GC90712@google.com> References: <1477054121-10198-1-git-send-email-richard@nod.at> <1477054121-10198-26-git-send-email-richard@nod.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1477054121-10198-26-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 Content-Length: 659 Lines: 18 On Fri, Oct 21, 2016 at 02:48:40PM +0200, Richard Weinberger wrote: > @@ -190,6 +191,10 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) > sizeof(policy))) > return -EFAULT; > > + err = ubifs_enable_encryption(c); > + if (err) > + return err; > + > err = fscrypt_process_policy(file, &policy); Is ubifs_enable_encryption() being done with proper locking and authorization? As-is, anyone can call this at any time if they can open some file on UBIFS. FYI, the approach being taken for ext4 is that the encryption feature flag has to be explicitly turned on before FS_IOC_SET_ENCRYPTION_POLICY will work. Eric