]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ovl: fix dentry reference leak
authorDavid Howells <dhowells@redhat.com>
Fri, 18 Sep 2015 10:45:22 +0000 (11:45 +0100)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 5 Feb 2016 03:28:25 +0000 (19:28 -0800)
commite6c45bcaa364ab0f1bc47637ba1185bab09db6ed
tree9309ff2b33f68417625117e83fb66650d5b9afb7
parentb773ed8a9be38050fc742c0fe0b4b03e4b70de30
ovl: fix dentry reference leak

Orabug: 22641610

commit ab79efab0a0ba01a74df782eb7fa44b044dae8b5 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>
(cherry picked from commit 7fd58acc9f6f751aebcee8288d020d959d815445)
Signed-off-by: Dan Duval <dan.duval@oracle.com>
fs/overlayfs/copy_up.c