Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1367592 > unrolled thread

[PATCH] f2fs crypto: fix corrupted symlink in encrypted case

Started byJaegeuk Kim <jaegeuk@kernel.org>
First post2016-03-30 22:30 +0200
Last post2016-03-30 22:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] f2fs crypto: fix corrupted symlink in encrypted case Jaegeuk Kim <jaegeuk@kernel.org> - 2016-03-30 22:30 +0200

#1367592 — [PATCH] f2fs crypto: fix corrupted symlink in encrypted case

FromJaegeuk Kim <jaegeuk@kernel.org>
Date2016-03-30 22:30 +0200
Subject[PATCH] f2fs crypto: fix corrupted symlink in encrypted case
Message-ID<riuUy-2hW-3@gated-at.bofh.it>
In the encrypted symlink case, we should check its corrupted symname after
decrypting it.
Otherwise, we can report -ENOENT incorrectly, if encrypted symname starts with
'\0'.

Cc: stable 4.5+ <stable@vger.kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/namei.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 7876f10..6214d9e 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -1027,12 +1027,6 @@ static const char *f2fs_encrypted_get_link(struct dentry *dentry,
 		goto errout;
 	}
 
-	/* this is broken symlink case */
-	if (unlikely(cstr.name[0] == 0)) {
-		res = -ENOENT;
-		goto errout;
-	}
-
 	if ((cstr.len + sizeof(struct fscrypt_symlink_data) - 1) > max_size) {
 		/* Symlink data on the disk is corrupted */
 		res = -EIO;
@@ -1046,6 +1040,12 @@ static const char *f2fs_encrypted_get_link(struct dentry *dentry,
 	if (res < 0)
 		goto errout;
 
+	/* this is broken symlink case */
+	if (unlikely(pstr.name[0] == 0)) {
+		res = -ENOENT;
+		goto errout;
+	}
+
 	paddr = pstr.name;
 
 	/* Null-terminate the name */
-- 
2.6.3

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web