Backport a patch that improves error handling in POSIX ACL conversions

Signed-off-by: tangyuchen <tangyuchen5@huawei.com>
(cherry picked from commit f0295863c40b11dc01fc0011afc3de9957005671)
This commit is contained in:
tangyuchen 2023-04-17 15:33:08 +08:00 committed by openeuler-sync-bot
parent 71dedd3852
commit 57b174babf
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From ea30eb29bac9b8ed7adca43024232069e1da0103 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Fri, 28 May 2021 22:14:04 -0500
Subject: [PATCH] libext2fs: improve error handling in POSIX ACL conversions
When encoding a POSIX ACL to the EXT4 ACL format, if an unknown tag
is encountered, that entry is silently ignored. It would be better
to return an error to inform the user that the ACL is incompatible.
Also fix the mismatched indentation in the opposite function.
Signed-off-by: Samuel Holland <samuel@sholland.org>
diff --git a/lib/ext2fs/ext_attr.c b/lib/ext2fs/ext_attr.c
index 8a7a17c..b882170 100644
--- a/lib/ext2fs/ext_attr.c
+++ b/lib/ext2fs/ext_attr.c
@@ -572,6 +572,8 @@ static errcode_t convert_posix_acl_to_disk_buffer(const void *value, size_t size
e += sizeof(ext4_acl_entry);
s += sizeof(ext4_acl_entry);
break;
+ default:
+ return EINVAL;
}
}
*size_out = s;
@@ -625,10 +627,9 @@ static errcode_t convert_disk_buffer_to_posix_acl(const void *value, size_t size
cp += sizeof(ext4_acl_entry);
size -= sizeof(ext4_acl_entry);
break;
- default:
- ext2fs_free_mem(&out);
- return EINVAL;
- break;
+ default:
+ ext2fs_free_mem(&out);
+ return EINVAL;
}
entry++;
}
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: e2fsprogs
Version: 1.45.6
Release: 18
Release: 19
Summary: Second extended file system management tools
License: GPLv2 and LGPLv2 and GPLv2+
URL: http://e2fsprogs.sourceforge.net/
@ -60,6 +60,7 @@ Patch50: 0050-mmp-fix-wrong-comparison-in-ext2fs_mmp_stop.patch
Patch51: 0051-misc-fsck.c-Processes-may-kill-other-processes.patch
Patch52: 0052-append_pathname-check-the-value-returned-by-realloc.patch
Patch53: 0053-argv_parse-check-return-value-of-malloc-in-argv_pars.patch
Patch54: 0054-libext2fs-improve-error-handling-in-POSIX-ACL-conver.patch
BuildRequires: gcc pkgconfig texinfo
BuildRequires: fuse-devel libblkid-devel libuuid-devel
@ -181,6 +182,9 @@ exit 0
%{_mandir}/man8/*
%changelog
* Mon Apr 17 tangyuchen <tangyuchen5@huawei.com> - 1.45.6-19
- backport 1 patch, improving error-handling in POSIX-ACL
* Fri Apr 14 tangyuchen <tangyuchen5@huawei.com> - 1.45.6-18
- backport 2 patches