From: Tyler Hicks <code@tyhicks.com>
To: Aditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu, Tyler Hicks <tyhicks@canonical.com>,
Andrew Morton <akpm@osdl.org>, Adrian Bunk <bunk@stusta.de>,
Randy Dunlap <rdunlap@infradead.org>,
Theodore Ts'o <tytso@mit.edu>,
ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ecryptfs: replace BUG_ON with error handling code
Date: Fri, 14 Feb 2020 14:44:41 -0600 [thread overview]
Message-ID: <20200214204441.GA254578@elm> (raw)
In-Reply-To: <20200214182101.17165-1-pakki001@umn.edu>
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@umn.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
>
prev parent reply other threads:[~2020-02-14 20:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-14 18:21 [PATCH v2] ecryptfs: replace BUG_ON with error handling code Aditya Pakki
2020-02-14 20:44 ` Tyler Hicks [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200214204441.GA254578@elm \
--to=code@tyhicks.com \
--cc=akpm@osdl.org \
--cc=bunk@stusta.de \
--cc=ecryptfs@vger.kernel.org \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=pakki001@umn.edu \
--cc=rdunlap@infradead.org \
--cc=tyhicks@canonical.com \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).