From patchwork Fri Mar 23 19:23:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10305495 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 7FCEF600CC for ; Fri, 23 Mar 2018 19:31:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 709B92912B for ; Fri, 23 Mar 2018 19:31:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 655462912D; Fri, 23 Mar 2018 19:31:32 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 0A2932912B for ; Fri, 23 Mar 2018 19:31:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752590AbeCWTb0 (ORCPT ); Fri, 23 Mar 2018 15:31:26 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:37191 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752326AbeCWTbV (ORCPT ); Fri, 23 Mar 2018 15:31:21 -0400 Received: by mail-pg0-f66.google.com with SMTP id n11so4948492pgp.4; Fri, 23 Mar 2018 12:31:21 -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=5wb8IX7wJNOB3Q/Ln5fBcnr4G+TY29tj8OSRUnB9bYk=; b=gbFFFg2zCBOdAZT3aTNWUxVR3DTlZqK7oRaAk4DyoxNrMqFPnOEuOko8yqp+wmmruD gvjtE939B9VWVfgT7f6H23TkK1cfCthkL2YOUz2wH5H5u0I/7E5oHym8Z+c8FHzrnXaf pcRjbW52AAfaTzRrzEvh0scNcZcBzqWIItYO2fGJ+D5XWV1VR8Md3EkEauF3d9WviuXi C5Aqc+VKYosWYMCpE/uh3vh5zlNCG9VW1BiG60vzH7F/apSfGkwiD9vCxaTlGulWTess acc9OSFA911OkNfz5gGovrnZSEOezk86jV0RHdYWmGqn/Yjmt0WK4dmjOo75R29b9djU MUug== 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=5wb8IX7wJNOB3Q/Ln5fBcnr4G+TY29tj8OSRUnB9bYk=; b=n5Fl9N7tbWT85jSDoJGG4JHh01gAbd4d+uPVjPMV3m8+K/pL8HCep+Ts8zavtmsRo/ 78dXp/cFAzZ34PaKIHBk+Yk2ZPLbqUbPUEvzm53hT+3dJ4g6G2mQlz2unttRYtJabXoi +kRUkB4gM718cZb+3LymfHDcnh8WosrTxvg5UnlAuaWbaUL1aztqTeo/j/pTTJHveeTv jMyGSsJ3nQgK5GQ/bDdzvsE0GWR8YebiaTL+3zCKPK/61lYaS5VW7IoTYvdHmRECymss W8R/G++P+VKwQhClU4j2/P3Trjzag14UfmnjAzqU7ZZ3HDirJDpuUf0CshF/2oTv0lcY G7kw== X-Gm-Message-State: AElRT7EAt68uV7lgTiU8QPBveJcmapU8d72u2qcDZVMXBS7DssPG52+Z PJ0TMX8cYBb14SmMDh5zESrVesGt X-Google-Smtp-Source: AG47ELvJEn0sVqAOEHbVCQFJnpFl3zjXLjMk+LTJYVGSe/tKdOolMN7hlGxFA5WaCtz6/LGrAkmCgw== X-Received: by 10.98.157.199 with SMTP id a68mr24852424pfk.237.1521833480732; Fri, 23 Mar 2018 12:31:20 -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 x1sm20924545pfk.144.2018.03.23.12.31.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 12:31:20 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org, "Theodore Y . Ts'o" Cc: linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, Jaegeuk Kim , Eric Biggers Subject: [PATCH 10/14] fscrypt: remove unnecessary check for non-logon key type Date: Fri, 23 Mar 2018 12:23:54 -0700 Message-Id: <20180323192358.95691-11-ebiggers3@gmail.com> X-Mailer: git-send-email 2.17.0.rc0.231.g781580f067-goog In-Reply-To: <20180323192358.95691-1-ebiggers3@gmail.com> References: <20180323192358.95691-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 1435a1c81010..4913a4d5204f 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 */