public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ecryptfs: Add missing gotos in ecryptfs_read_metadata
@ 2026-01-11  0:36 Thorsten Blum
  2026-01-11  1:08 ` Al Viro
  2026-01-12 19:21 ` Tyler Hicks
  0 siblings, 2 replies; 5+ messages in thread
From: Thorsten Blum @ 2026-01-11  0:36 UTC (permalink / raw)
  To: Tyler Hicks, Thorsten Blum, Ard Biesheuvel, Zipeng Zhang,
	Christian Brauner, Eric Biggers, Michael Halcrow, Andrew Morton
  Cc: stable, ecryptfs, linux-kernel

Add two missing goto statements to exit ecryptfs_read_metadata() when an
error occurs.

The first goto is required; otherwise ECRYPTFS_METADATA_IN_XATTR may be
set when xattr metadata is enabled even though parsing the metadata
failed. The second goto is not strictly necessary, but it makes the
error path explicit instead of relying on falling through to 'out'.

Cc: stable@vger.kernel.org
Fixes: dd2a3b7ad98f ("[PATCH] eCryptfs: Generalize metadata read/write")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 fs/ecryptfs/crypto.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 260f8a4938b0..d49cdf7292ab 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1328,6 +1328,7 @@ int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry)
 			       "file xattr region either, inode %lu\n",
 				ecryptfs_inode->i_ino);
 			rc = -EINVAL;
+			goto out;
 		}
 		if (crypt_stat->mount_crypt_stat->flags
 		    & ECRYPTFS_XATTR_METADATA_ENABLED) {
@@ -1340,6 +1341,7 @@ int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry)
 			       "this like an encrypted file, inode %lu\n",
 				ecryptfs_inode->i_ino);
 			rc = -EINVAL;
+			goto out;
 		}
 	}
 out:
-- 
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-12 19:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-11  0:36 [PATCH] ecryptfs: Add missing gotos in ecryptfs_read_metadata Thorsten Blum
2026-01-11  1:08 ` Al Viro
2026-01-11 12:28   ` Thorsten Blum
2026-01-12 19:23     ` Tyler Hicks
2026-01-12 19:21 ` Tyler Hicks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox