From patchwork Mon Apr 30 22:51:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10373041 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EA7C160234 for ; Mon, 30 Apr 2018 22:57:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D87281FF83 for ; Mon, 30 Apr 2018 22:57:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC927212DA; Mon, 30 Apr 2018 22:57:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FE6820243 for ; Mon, 30 Apr 2018 22:57:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751384AbeD3W5C (ORCPT ); Mon, 30 Apr 2018 18:57:02 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:38363 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755410AbeD3W4t (ORCPT ); Mon, 30 Apr 2018 18:56:49 -0400 Received: by mail-pg0-f66.google.com with SMTP id n9-v6so7261896pgq.5; Mon, 30 Apr 2018 15:56:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3cyCdxl8Vwv2++i/twiDN1wy2fYcNtoWWfr0H8Mse3A=; b=fwq1OzWkvR527SVGJBKhuRmSp43LOuEjAIaoy1AXgrn3nQGslkLRaatNV06cv3PwEh tPMmZ/YmYcsuYLC9TXYYiyt4dm1vJAkK9jc8oHKTfPu3b1y6mOus6qwKSuyQ3HOH68Lf 99G6+qm9456iFcP2mYvJFIfQAamhFvIzu0ZkrbvT8lSPifpUZFrRfK7ta/kqaZXsnFvi GbGJOU4mDCDIYc4hiHqykMyxxTbndKgDKR9UkMW4JTWJUs01l2n/g4INlCrq9s7UVheR fhxSMy6EU15istUtdA2x1BN/ODzVT0eSpPpCeVllEAX2O6YQxvlFpiBLGfSwtp6SovYg SgCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3cyCdxl8Vwv2++i/twiDN1wy2fYcNtoWWfr0H8Mse3A=; b=L+no4Q6mvgqWCIPY/R7NEt3zIF1kLUxgL7m0ImGuHEmYw2pUL3PeJnO5vgqAW7z7RM ZF5NH07yjAN9cprpihSM5g42kzIr3/ljBr270TmOJ20LEEMjSMACyzrEKLJft0MrkBS2 Ohzg7RldZUxFLufjLFqrgsvHmpn4Q84oJGMkK+2Pkw978IEld6DVHIONSdIt+7JoUzzV VtrUIsLyOm1ioqynz36qibH0F18N3tGqomn1MD8bhm4l9CbD1oAXO/hceinXJvCK4i6X wqhTdUmr3avpdG74/82BskQRpSiitAKmqc4gOjEMTit3W7Oe0kjQh+Hu+UAUQD8bXG3U N0Ig== X-Gm-Message-State: ALQs6tCqo6OeIko2oepFMntbxotFxEjjoTE2tDrmDyJQ/yr/N1ACasse 717ROJI3J4q21muJgxp5HRwA2nvw X-Google-Smtp-Source: AB8JxZrgWFXcF1KSeBYAaUjK6gL9T2N9/S6JKV/omTFVdPxy70O8mRgJSQHvw6HN4QLp9mS8GS4s+w== X-Received: by 2002:a63:6d07:: with SMTP id i7-v6mr11121218pgc.174.1525129008831; Mon, 30 Apr 2018 15:56:48 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([2620:15c:17:3:dc28:5c82:b905:e8a8]) by smtp.gmail.com with ESMTPSA id b15sm12969305pfi.111.2018.04.30.15.56.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Apr 2018 15:56:48 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org, "Theodore Y . Ts'o" Cc: Jaegeuk Kim , linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, Eric Biggers Subject: [PATCH 11/15] fscrypt: remove unnecessary check for non-logon key type Date: Mon, 30 Apr 2018 15:51:45 -0700 Message-Id: <20180430225149.183514-12-ebiggers3@gmail.com> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180430225149.183514-1-ebiggers3@gmail.com> References: <20180430225149.183514-1-ebiggers3@gmail.com> Sender: linux-fscrypt-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers We're passing 'key_type_logon' to request_key(), so the found key is guaranteed to be of type "logon". Thus, there is no reason to check later that the key is really a "logon" key. Signed-off-by: Eric Biggers --- fs/crypto/keyinfo.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/fs/crypto/keyinfo.c b/fs/crypto/keyinfo.c index 0f6a65c6483b..0b48aa469453 100644 --- a/fs/crypto/keyinfo.c +++ b/fs/crypto/keyinfo.c @@ -89,12 +89,6 @@ static int validate_user_key(struct fscrypt_info *crypt_info, return PTR_ERR(keyring_key); down_read(&keyring_key->sem); - if (keyring_key->type != &key_type_logon) { - printk_once(KERN_WARNING - "%s: key type must be logon\n", __func__); - res = -ENOKEY; - goto out; - } ukp = user_key_payload_locked(keyring_key); if (!ukp) { /* key was revoked before we acquired its semaphore */