Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933334AbcJXGzR (ORCPT ); Mon, 24 Oct 2016 02:55:17 -0400 Received: from b.ns.miles-group.at ([95.130.255.144]:44723 "EHLO radon.swed.at" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757187AbcJXGyN (ORCPT ); Mon, 24 Oct 2016 02:54:13 -0400 Subject: Re: [PATCH 20/26] ubifs: Add support for encrypted symlinks To: Eric Biggers References: <1477054121-10198-1-git-send-email-richard@nod.at> <1477054121-10198-21-git-send-email-richard@nod.at> <20161021184231.GD90712@google.com> 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 From: Richard Weinberger Message-ID: Date: Mon, 24 Oct 2016 08:54:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: <20161021184231.GD90712@google.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 972 Lines: 42 Eric, On 21.10.2016 20:42, Eric Biggers wrote: > On Fri, Oct 21, 2016 at 02:48:35PM +0200, Richard Weinberger wrote: >> + >> + if (!dentry) >> + return ERR_PTR(-ECHILD); >> + >> + if (ubifs_crypt_is_encrypted(inode)) { >> + err = fscrypt_get_encryption_info(inode); >> + if (err) >> + return ERR_PTR(err); >> + } else >> + return ui->data; >> + > > This will make path lookups drop out of RCU mode when an unencrypted symlink is > followed. This can be avoided by checking for unencrypted symlinks first: Oh! Thanks for pointing this out! > if (!ubifs_crypt_is_encrypted(inode)) > return ui->data; > > if (!dentry) > return ERR_PTR(-ECHILD); > > err = fscrypt_get_encryption_info(inode); > if (err) > return ERR_PTR(err); > >> + >> + pstr.name[err] = '\0'; >> + > > In 4.9, fscrypt_fname_{disk_to_usr,usr_to_disk} return 0 instead of the output > length, so this will need to be changed to 'pstr.name[pstr.len] = '\0''. Noted. Thanks, //richard