Miklos Szeredi 5e12758086 ovl: check whiteout in ovl_create_over_whiteout()
Kaixuxia repors that it's possible to crash overlayfs by removing the
whiteout on the upper layer before creating a directory over it.  This is a
reproducer:

 mkdir lower upper work merge
 touch lower/file
 mount -t overlay overlay -olowerdir=lower,upperdir=upper,workdir=work merge
 rm merge/file
 ls -al merge/file
 rm upper/file
 ls -al merge/
 mkdir merge/file

Before commencing with a vfs_rename(..., RENAME_EXCHANGE) verify that the
lookup of "upper" is positive and is a whiteout, and return ESTALE
otherwise.

Reported by: kaixuxia <xiakaixu1987@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Fixes: e9be9d5e76e3 ("overlay filesystem")
Cc: <stable@vger.kernel.org> # v3.18
2018-10-31 12:15:23 +01:00
..
2018-10-15 15:31:47 +02:00
2018-09-06 09:04:45 -07:00
2018-06-11 10:16:13 -07:00
2018-08-21 23:54:17 -04:00
2018-08-22 13:29:39 -07:00
2018-08-21 18:47:36 -07:00
2018-08-17 16:20:28 -07:00
2018-08-15 22:47:23 -07:00
2018-08-18 11:44:53 -07:00
2018-05-22 14:27:52 -04:00
2018-09-14 19:25:28 -10:00
2018-08-17 16:20:27 -07:00
2018-10-13 09:31:02 +02:00
2018-05-22 14:27:52 -04:00
2018-08-18 11:44:53 -07:00
2018-07-03 16:44:45 -04:00
2018-08-14 10:23:25 -07:00
2018-06-05 19:23:26 +02:00
2018-08-21 18:19:09 -07:00
2018-05-03 16:11:37 -06:00
2018-08-21 18:19:09 -07:00
2018-08-21 18:19:09 -07:00
2018-06-11 08:22:34 -07:00
2018-08-21 18:19:09 -07:00
2018-02-15 15:34:42 -05:00
2018-08-21 18:19:09 -07:00
2018-04-04 12:44:02 -07:00