linux/fs/overlayfs
David Howells 7fd58acc9f ovl: fix dentry reference leak
commit ab79efab0a upstream.

In ovl_copy_up_locked(), newdentry is leaked if the function exits through
out_cleanup as this just to out after calling ovl_cleanup() - which doesn't
actually release the ref on newdentry.

The out_cleanup segment should instead exit through out2 as certainly
newdentry leaks - and possibly upper does also, though this isn't caught
given the catch of newdentry.

Without this fix, something like the following is seen:

	BUG: Dentry ffff880023e9eb20{i=f861,n=#ffff880023e82d90} still in use (1) [unmount of tmpfs tmpfs]
	BUG: Dentry ffff880023ece640{i=0,n=bigfile}  still in use (1) [unmount of tmpfs tmpfs]

when unmounting the upper layer after an error occurred in copyup.

An error can be induced by creating a big file in a lower layer with
something like:

	dd if=/dev/zero of=/lower/a/bigfile bs=65536 count=1 seek=$((0xf000))

to create a large file (4.1G).  Overlay an upper layer that is too small
(on tmpfs might do) and then induce a copy up by opening it writably.

Reported-by: Ulrich Obergfell <uobergfe@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2015-11-09 14:33:38 -08:00
..
copy_up.c ovl: fix dentry reference leak 2015-11-09 14:33:38 -08:00
dir.c ovl: mount read-only if workdir can't be created 2015-05-19 14:30:12 +02:00
inode.c fix a braino in ovl_d_select_inode() 2015-10-22 14:43:26 -07:00
Kconfig ovl: rename filesystem type to "overlay" 2014-11-20 16:39:59 +01:00
Makefile ovl: rename filesystem type to "overlay" 2014-11-20 16:39:59 +01:00
overlayfs.h overlayfs: Make f_path always point to the overlay and f_inode to the underlay 2015-10-22 14:43:26 -07:00
readdir.c ovl: lookup whiteouts outside iterate_dir() 2015-08-03 09:29:16 -07:00
super.c ovl: free lower_mnt array in ovl_put_super 2015-11-09 14:33:38 -08:00