Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5696452ybv; Tue, 11 Feb 2020 21:55:35 -0800 (PST) X-Google-Smtp-Source: APXvYqxyohOfKGRoki21eJfPT/bl4f0P9zdYVP125QDSTC5YL74Uay4kwQxLxoj8PDG60as+74I9 X-Received: by 2002:a9d:62d8:: with SMTP id z24mr5736983otk.362.1581486934991; Tue, 11 Feb 2020 21:55:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581486934; cv=none; d=google.com; s=arc-20160816; b=otpOfaa0PNVY2lbQWzF4arKN7g1PIfx+5KjrywQfxLjY7OV/ClNFnH3zpBnUF99EDs 6MCMiZdkWhP24QYjd1vuJYgmywurCNFV3uJ45339eEqJtGVYyJ49nEZqF3SKKalPiZw1 thkJMky0yWEPT3XuJAc0vIQieSopJ4vuz/ln6I1IGz6u3adKBHJrl3l5SEIN97qyhfVi uSYU2By5gxIG8TrGROzmF9b8vKO3AYoEovYn330uFx8RHYxUSSRnWcnudexo6VZENEm8 5QWX9qyCyTeFzS6zyKTTeTliC+XH85VH3o7tRIBcBPjnlpZWqcowt6Km3l7hrFcvHTye TKkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=tVWWvoDZAgwKcsY1mlpUXPh9b/FAVENIRiV5AyTWJ8s=; b=EN+q8gxf9e3GKM2a1N6gWN2adCKX6X/BoP6HjX0Fm5ZdGPMX8qaa/MLF8zLNsEUAD6 K/YIvdG20z6D2NCsZwQ4ZdRHg21N1NqYKkNl7oj1TnDD9vRiuM7e9unWaOaJDIZkibeA D2e34nWNTevPCvcjqhNKP7ZwCiDUfh8eW6wWJFv0nPNau6NRD42qXMPy+STbmktTHTk7 xsp67rYIV6TdlvhutnNAMaXq9jvbJuOdKQiCsTtTCjgluaUKOYeOGGCKgYWvIwMlVxA1 laYg5GN/qz9vaCHHz26iURAapvkKrcIbXi6gKUqZoSXyKoKgUWkQi8DsCF4tT8xDnZca pxYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l17si3181210otk.218.2020.02.11.21.55.22; Tue, 11 Feb 2020 21:55:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728162AbgBLFzS (ORCPT + 99 others); Wed, 12 Feb 2020 00:55:18 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:59876 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728150AbgBLFzS (ORCPT ); Wed, 12 Feb 2020 00:55:18 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1j1kzP-00BGKg-Vq; Wed, 12 Feb 2020 05:55:12 +0000 Date: Wed, 12 Feb 2020 05:55:11 +0000 From: Al Viro To: Eric Biggers Cc: Daniel Rosenberg , Theodore Ts'o , linux-ext4@vger.kernel.org, Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, linux-fscrypt@vger.kernel.org, Richard Weinberger , linux-mtd@lists.infradead.org, Andreas Dilger , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Gabriel Krisman Bertazi , kernel-team@android.com Subject: Re: [PATCH v7 6/8] f2fs: Handle casefolding with Encryption Message-ID: <20200212055511.GL23230@ZenIV.linux.org.uk> References: <20200208013552.241832-1-drosen@google.com> <20200208013552.241832-7-drosen@google.com> <20200212051013.GG870@sol.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200212051013.GG870@sol.localdomain> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Feb 11, 2020 at 09:10:13PM -0800, Eric Biggers wrote: > How about: > > int f2fs_ci_compare(const struct inode *parent, const struct qstr *name, > u8 *de_name, size_t de_name_len, bool quick) > { > const struct super_block *sb = parent->i_sb; > const struct unicode_map *um = sb->s_encoding; > struct fscrypt_str decrypted_name = FSTR_INIT(NULL, de_name_len); > struct qstr entry = QSTR_INIT(de_name, de_name_len); > int ret; > > if (IS_ENCRYPTED(parent)) { oops. parent->d_inode is unstable here; could have become NULL by that point. > if (quick) > ret = utf8_strncasecmp_folded(um, name, &entry); > else > ret = utf8_strncasecmp(um, name, &entry); > if (ret < 0) { > /* Handle invalid character sequence as either an error > * or as an opaque byte sequence. > */ Really? How would the callers possibly tell mismatch from an error? And if they could, would would they *do* with that error, seeing that it might be an effect of a race with rename()? Again, ->d_compare() is NOT given a stable name. Or *parent. Or (parent->d_inode).