Commit 77a28aa4 authored by Amir Goldstein's avatar Amir Goldstein
Browse files

ovl: relax WARN_ON in ovl_verify_area()



syzbot hit an assertion in copy up data loop which looks like it is
the result of a lower file whose size is being changed underneath
overlayfs.

This type of use case is documented to cause undefined behavior, so
returning EIO error for the copy up makes sense, but it should not be
causing a WARN_ON assertion.

Reported-and-tested-by: default avatar <syzbot+3abd99031b42acf367ef@syzkaller.appspotmail.com>
Fixes: ca7ab482 ("ovl: add permission hooks outside of do_splice_direct()")
Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
parent 1b17f399
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -234,11 +234,11 @@ static int ovl_verify_area(loff_t pos, loff_t pos2, loff_t len, loff_t totlen)
{
	loff_t tmp;

	if (WARN_ON_ONCE(pos != pos2))
	if (pos != pos2)
		return -EIO;
	if (WARN_ON_ONCE(pos < 0 || len < 0 || totlen < 0))
	if (pos < 0 || len < 0 || totlen < 0)
		return -EIO;
	if (WARN_ON_ONCE(check_add_overflow(pos, len, &tmp)))
	if (check_add_overflow(pos, len, &tmp))
		return -EIO;
	return 0;
}