[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5be98aad-66b9-2549-2772-ef30aa1275b4@linux.microsoft.com>
Date: Fri, 25 Oct 2019 09:02:47 -0700
From: Lakshmi Ramasubramanian <nramas@...ux.microsoft.com>
To: Nayna Jain <nayna@...ux.ibm.com>, linuxppc-dev@...abs.org,
linux-efi@...r.kernel.org, linux-integrity@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Michael Ellerman <mpe@...erman.id.au>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Jeremy Kerr <jk@...abs.org>,
Matthew Garret <matthew.garret@...ula.com>,
Mimi Zohar <zohar@...ux.ibm.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Claudio Carvalho <cclaudio@...ux.ibm.com>,
George Wilson <gcwilson@...ux.ibm.com>,
Elaine Palmer <erpalmer@...ibm.com>,
Eric Ricther <erichte@...ux.ibm.com>,
Oliver O'Halloran <oohall@...il.com>
Subject: Re: [PATCH v5 4/4] powerpc: load firmware trusted keys/hashes into
kernel keyring
On 10/24/19 5:58 PM, Nayna Jain wrote:
> +
> +/*
> + * Get a certificate list blob from the named secure variable.
> + */
> +static __init void *get_cert_list(u8 *key, unsigned long keylen, uint64_t *size)
> +{
> + int rc;
> + void *db;
> +
> + rc = secvar_ops->get(key, keylen, NULL, size);
> + if (rc) {
> + pr_err("Couldn't get size: %d\n", rc);
> + return NULL;
> + }
> +
> + db = kmalloc(*size, GFP_KERNEL);
Is there a MIN\MAX limit on size that should be validated here before
memory allocation?
> + if (!db)
> + return NULL;
> +
> + rc = secvar_ops->get(key, keylen, db, size);
> + if (rc) {
> + kfree(db);
> + pr_err("Error reading db var: %d\n", rc);
> + return NULL;
nit: set db to NULL and return from the end of the function.
> + }
> +
> + return db;
> +}
Powered by blists - more mailing lists