2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-12 07:34:08 +08:00
linux-next/fs/overlayfs
Yuxuan Shui 520da69d26 ovl: initialize error in ovl_copy_xattr
In ovl_copy_xattr, if all the xattrs to be copied are overlayfs private
xattrs, the copy loop will terminate without assigning anything to the
error variable, thus returning an uninitialized value.

If ovl_copy_xattr is called from ovl_clear_empty, this uninitialized error
value is put into a pointer by ERR_PTR(), causing potential invalid memory
accesses down the line.

This commit initialize error with 0. This is the correct value because when
there's no xattr to copy, because all xattrs are private, ovl_copy_xattr
should succeed.

This bug is discovered with the help of INIT_STACK_ALL and clang.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Link: https://bugs.chromium.org/p/chromium/issues/detail?id=1050405
Fixes: 0956254a2d ("ovl: don't copy up opaqueness")
Cc: stable@vger.kernel.org # v4.8
Signed-off-by: Alexander Potapenko <glider@google.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2020-06-04 10:48:19 +02:00
..
copy_up.c ovl: initialize error in ovl_copy_xattr 2020-06-04 10:48:19 +02:00
dir.c ovl: initialize OVL_UPPERDATA in ovl_lookup() 2020-06-02 22:20:25 +02:00
export.c ovl: return required buffer size for file handles 2020-05-13 11:11:24 +02:00
file.c ovl: check permission to open real file 2020-06-03 09:45:22 +02:00
inode.c ovl: initialize OVL_UPPERDATA in ovl_lookup() 2020-06-02 22:20:25 +02:00
Kconfig ovl: fix some xino configurations 2020-03-13 15:53:06 +01:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
namei.c ovl: drop negative dentry in upper layer 2020-06-03 09:45:22 +02:00
overlayfs.h ovl: fix out of bounds access warning in ovl_check_fb_len() 2020-06-02 22:20:25 +02:00
ovl_entry.h ovl: whiteout inode sharing 2020-05-13 11:11:24 +02:00
readdir.c ovl: switch to mounter creds in readdir 2020-06-02 22:20:25 +02:00
super.c ovl: sync dirty data when remounting to ro mode 2020-05-13 11:11:24 +02:00
util.c ovl: verify permissions in ovl_path_open() 2020-06-02 22:20:26 +02:00