Patch "ovl: check whiteout in ovl_create_over_whiteout()" has been added to the 4.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ovl: check whiteout in ovl_create_over_whiteout()

to the 4.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ovl-check-whiteout-in-ovl_create_over_whiteout.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 5e1275808630ea3b2c97c776f40e475017535f72 Mon Sep 17 00:00:00 2001
From: Miklos Szeredi <mszeredi@xxxxxxxxxx>
Date: Wed, 31 Oct 2018 12:15:23 +0100
Subject: ovl: check whiteout in ovl_create_over_whiteout()

From: Miklos Szeredi <mszeredi@xxxxxxxxxx>

commit 5e1275808630ea3b2c97c776f40e475017535f72 upstream.

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@xxxxxxxxx>
Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxxxxx>
Fixes: e9be9d5e76e3 ("overlay filesystem")
Cc: <stable@xxxxxxxxxxxxxxx> # v3.18
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

--- a/fs/overlayfs/dir.c
+++ b/fs/overlayfs/dir.c
@@ -392,6 +392,10 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode,
 	if (IS_ERR(upper))
 		goto out_dput;
 
+	err = -ESTALE;
+	if (d_is_negative(upper) || !IS_WHITEOUT(d_inode(upper)))
+		goto out_dput2;
+
 	err = ovl_create_real(wdir, newdentry, cattr, hardlink, true);
 	if (err)
 		goto out_dput2;
-- 
2.14.5



Patches currently in stable-queue which might be from mszeredi@xxxxxxxxxx are

queue-4.9/fuse-set-fr_sent-while-locked.patch
queue-4.9/ovl-check-whiteout-in-ovl_create_over_whiteout.patch
queue-4.9/fuse-fix-use-after-free-in-fuse_direct_io.patch
queue-4.9/fuse-fix-leaked-notify-reply.patch
queue-4.9/fuse-fix-use-after-free-in-fuse_dev_do_read.patch
queue-4.9/fuse-fix-use-after-free-in-fuse_dev_do_write.patch
queue-4.9/fuse-fix-blocked_waitq-wakeup.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux