[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200214204441.GA254578@elm>
Date: Fri, 14 Feb 2020 14:44:41 -0600
From: Tyler Hicks <code@...icks.com>
To: Aditya Pakki <pakki001@....edu>
Cc: kjlu@....edu, Tyler Hicks <tyhicks@...onical.com>,
Andrew Morton <akpm@...l.org>, Adrian Bunk <bunk@...sta.de>,
Randy Dunlap <rdunlap@...radead.org>,
Theodore Ts'o <tytso@....edu>, ecryptfs@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] ecryptfs: replace BUG_ON with error handling code
On 2020-02-14 12:21:01, Aditya Pakki wrote:
> In crypt_scatterlist, if the crypt_stat argument is not set up
> correctly, the kernel crashes. Instead, by returning an error code
> upstream, the error is handled safely.
>
> The issue is detected via a static analysis tool written by us.
>
> Fixes: 237fead619984 (ecryptfs: fs/Makefile and fs/Kconfig)
> Signed-off-by: Aditya Pakki <pakki001@....edu>
Thanks! This looks good to me and passes the eCryptfs regression tests.
I've queued it up in my tree.
Tyler
> ---
> v1: Add missing fixes tag suggested by Markus and Tyler.
> ---
> fs/ecryptfs/crypto.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
> index db1ef144c63a..2c449aed1b92 100644
> --- a/fs/ecryptfs/crypto.c
> +++ b/fs/ecryptfs/crypto.c
> @@ -311,8 +311,10 @@ static int crypt_scatterlist(struct ecryptfs_crypt_stat *crypt_stat,
> struct extent_crypt_result ecr;
> int rc = 0;
>
> - BUG_ON(!crypt_stat || !crypt_stat->tfm
> - || !(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED));
> + if (!crypt_stat || !crypt_stat->tfm
> + || !(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED))
> + return -EINVAL;
> +
> if (unlikely(ecryptfs_verbosity > 0)) {
> ecryptfs_printk(KERN_DEBUG, "Key size [%zd]; key:\n",
> crypt_stat->key_size);
> --
> 2.20.1
>
Powered by blists - more mailing lists