[RFC PATCH v1 3/4] ubifs: auth: remove never hit key type error check

From: Ahmad Fatoum
Date: Thu Jul 22 2021 - 05:18:38 EST


key_request accepts a key type as its first argument. If it returns a
valid pointer, it should always have this same requested key type.

Indeed other request_key users surveyed such as dm-crypt, ecryptfs
and fscrypt v1 also don't check the key type. Therefore drop the
apparently unneeded check.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
To: David Howells <dhowells@xxxxxxxxxx>
To: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
To: James Morris <jmorris@xxxxxxxxx>
To: "Serge E. Hallyn" <serge@xxxxxxxxxx>
To: Alasdair Kergon <agk@xxxxxxxxxx>
To: Mike Snitzer <snitzer@xxxxxxxxxx>
To: dm-devel@xxxxxxxxxx
To: Song Liu <song@xxxxxxxxxx>
To: Richard Weinberger <richard@xxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: linux-raid@xxxxxxxxxxxxxxx
Cc: keyrings@xxxxxxxxxxxxxxx
Cc: linux-mtd@xxxxxxxxxxxxxxxxxxx
Cc: linux-security-module@xxxxxxxxxxxxxxx
Cc: linux-integrity@xxxxxxxxxxxxxxx
---
fs/ubifs/auth.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/fs/ubifs/auth.c b/fs/ubifs/auth.c
index e564d5ff8781..6a0b8d858d81 100644
--- a/fs/ubifs/auth.c
+++ b/fs/ubifs/auth.c
@@ -286,12 +286,6 @@ int ubifs_init_authentication(struct ubifs_info *c)

down_read(&keyring_key->sem);

- if (keyring_key->type != &key_type_logon) {
- ubifs_err(c, "key type must be logon");
- err = -ENOKEY;
- goto out;
- }
-
ukp = user_key_payload_locked(keyring_key);
if (!ukp) {
/* key was revoked before we acquired its semaphore */
--
git-series 0.9.1