linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: add additional sanity check in f2fs_acl_from_disk()
@ 2018-08-30 13:33 Chengguang Xu
  2018-08-30 15:41 ` Chao Yu
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Chengguang Xu @ 2018-08-30 13:33 UTC (permalink / raw)
  To: jaegeuk, yuchao0; +Cc: Chengguang Xu, linux-f2fs-devel

Add additinal sanity check for irregular case(e.g. corruption).
If size of extended attribution is smaller than size of acl header,
then return -EINVAL.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 fs/f2fs/acl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
index 111824199a88..79e9ea773070 100644
--- a/fs/f2fs/acl.c
+++ b/fs/f2fs/acl.c
@@ -53,6 +53,9 @@ static struct posix_acl *f2fs_acl_from_disk(const char *value, size_t size)
 	struct f2fs_acl_entry *entry = (struct f2fs_acl_entry *)(hdr + 1);
 	const char *end = value + size;
 
+	if (size < sizeof(f2fs_acl_header))
+		return ERR_PTR(-EINVAL);
+
 	if (hdr->a_version != cpu_to_le32(F2FS_ACL_VERSION))
 		return ERR_PTR(-EINVAL);
 
-- 
2.17.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

end of thread, other threads:[~2018-09-05 16:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-30 13:33 [PATCH] f2fs: add additional sanity check in f2fs_acl_from_disk() Chengguang Xu
2018-08-30 15:41 ` Chao Yu
2018-08-30 16:19   ` cgxu519
2018-08-31  7:02     ` Chao Yu
2018-08-31 11:40       ` Chengguang Xu
2018-08-31 12:16         ` Chao Yu
2018-08-31 12:17 ` Chao Yu
2018-09-05  4:28 ` Jaegeuk Kim
2018-09-05  5:54   ` Chao Yu
2018-09-05 16:59     ` Jaegeuk Kim

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).