|
Kmods SIG |
c540c3 |
From c6052f09c14bf0ecdd582662e022eb716f9b8022 Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
c540c3 |
From: Phillip Potter <phil@philpotter.co.uk>
|
|
Kmods SIG |
c540c3 |
Date: Mon, 3 May 2021 13:57:16 +0200
|
|
Kmods SIG |
c540c3 |
Subject: [Backport c6052f09c14b] fs: ecryptfs: remove BUG_ON from
|
|
Kmods SIG |
c540c3 |
crypt_scatterlist
|
|
Kmods SIG |
c540c3 |
|
|
Kmods SIG |
c540c3 |
crypt_stat memory itself is allocated when inode is created, in
|
|
Kmods SIG |
c540c3 |
ecryptfs_alloc_inode, which returns NULL on failure and is handled
|
|
Kmods SIG |
c540c3 |
by callers, which would prevent us getting to this point. It then
|
|
Kmods SIG |
c540c3 |
calls ecryptfs_init_crypt_stat which allocates crypt_stat->tfm
|
|
Kmods SIG |
c540c3 |
checking for and likewise handling allocation failure. Finally,
|
|
Kmods SIG |
c540c3 |
crypt_stat->flags has ECRYPTFS_STRUCT_INITIALIZED merged into it
|
|
Kmods SIG |
c540c3 |
in ecryptfs_init_crypt_stat as well.
|
|
Kmods SIG |
c540c3 |
|
|
Kmods SIG |
c540c3 |
Simply put, the conditions that the BUG_ON checks for will never
|
|
Kmods SIG |
c540c3 |
be triggered, as to even get to this function, the relevant conditions
|
|
Kmods SIG |
c540c3 |
will have already been fulfilled (or the inode allocation would fail in
|
|
Kmods SIG |
c540c3 |
the first place and thus no call to this function or those above it).
|
|
Kmods SIG |
c540c3 |
|
|
Kmods SIG |
c540c3 |
Cc: Tyler Hicks <code@tyhicks.com>
|
|
Kmods SIG |
c540c3 |
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
|
|
Kmods SIG |
c540c3 |
Link: https://lore.kernel.org/r/20210503115736.2104747-50-gregkh@linuxfoundation.org
|
|
Kmods SIG |
c540c3 |
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
Kmods SIG |
c540c3 |
---
|
|
Kmods SIG |
c540c3 |
src/crypto.c | 2 --
|
|
Kmods SIG |
c540c3 |
1 file changed, 2 deletions(-)
|
|
Kmods SIG |
c540c3 |
|
|
Kmods SIG |
c540c3 |
diff --git a/src/crypto.c b/src/crypto.c
|
|
Kmods SIG |
c540c3 |
index b1aa993784f777b53cd7d9c126f78e0f20bf5de7..e3f5d7f3c8a0ad12eb04be0c89b1b63910b31d6d 100644
|
|
Kmods SIG |
c540c3 |
--- a/src/crypto.c
|
|
Kmods SIG |
c540c3 |
+++ b/src/crypto.c
|
|
Kmods SIG |
c540c3 |
@@ -296,8 +296,6 @@ static int crypt_scatterlist(struct ecryptfs_crypt_stat *crypt_stat,
|
|
Kmods SIG |
c540c3 |
struct extent_crypt_result ecr;
|
|
Kmods SIG |
c540c3 |
int rc = 0;
|
|
Kmods SIG |
c540c3 |
|
|
Kmods SIG |
c540c3 |
- BUG_ON(!crypt_stat || !crypt_stat->tfm
|
|
Kmods SIG |
c540c3 |
- || !(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED));
|
|
Kmods SIG |
c540c3 |
if (unlikely(ecryptfs_verbosity > 0)) {
|
|
Kmods SIG |
c540c3 |
ecryptfs_printk(KERN_DEBUG, "Key size [%zd]; key:\n",
|
|
Kmods SIG |
c540c3 |
crypt_stat->key_size);
|
|
Kmods SIG |
c540c3 |
--
|
|
Kmods SIG |
c540c3 |
2.31.1
|
|
Kmods SIG |
c540c3 |
|