diff options
| author | Chengguang Xu <cgxu519@gmx.com> | 2018-08-30 21:33:31 +0800 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2018-12-01 23:27:46 +0100 |
| commit | 022d1ab06a38c231bbff6adefb86468e03288ee7 (patch) | |
| tree | eea7a36b5b4980f3c86f43bafb3db4daaef8f7c3 | |
| parent | fc6b2a210553b1f44fb20418aca478477d4bf5f6 (diff) | |
f2fs: add additional sanity check in f2fs_acl_from_disk()
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>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
| -rw-r--r-- | fs/f2fs/acl.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c index 90be9b77d..e72fe337f 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(struct f2fs_acl_header)) + return ERR_PTR(-EINVAL); + if (hdr->a_version != cpu_to_le32(F2FS_ACL_VERSION)) return ERR_PTR(-EINVAL); |
