1
0
Fork 0
alistair23-linux/fs/overlayfs
Yuxuan Shui 98a3dea7e2 ovl: initialize error in ovl_copy_xattr
commit 520da69d26 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-17 16:40:32 +02:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
copy_up.c ovl: initialize error in ovl_copy_xattr 2020-06-17 16:40:32 +02:00
dir.c ovl: relax WARN_ON() on rename to self 2019-12-17 19:56:11 +01:00
export.c ovl: Fix dereferencing possible ERR_PTR() 2019-09-11 16:11:45 +02:00
file.c ovl: fix lseek overflow on 32bit 2020-02-11 04:35:24 -08:00
inode.c ovl: fix value of i_ino for lower hardlink corner case 2020-04-21 09:04:50 +02:00
namei.c ovl: fix lookup failure on multi lower squashfs 2019-12-17 19:56:10 +01:00
overlayfs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
ovl_entry.h ovl: fix lookup failure on multi lower squashfs 2019-12-17 19:56:10 +01:00
readdir.c ovl: fix wrong WARN_ON() in ovl_cache_update_ino() 2020-02-11 04:35:24 -08:00
super.c ovl: fix lookup failure on multi lower squashfs 2019-12-17 19:56:10 +01:00
util.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00