]> git.hungrycats.org Git - linux/commit
fix deadlock in cifs_ioctl_clone()
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 19 Jan 2015 04:37:32 +0000 (23:37 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 30 Jan 2015 01:40:45 +0000 (17:40 -0800)
commit24f1a316c4bfeed2e1d9a7803545839e2d2e4a0b
treeb257aae3dbbf73bfce768a1a12eb76624e8e85b1
parent3436c0aadcc5827fcce5ef3b33d4d523720f7137
fix deadlock in cifs_ioctl_clone()

commit 378ff1a53b5724f3ac97b0aba3c9ecac072f6fcd upstream.

It really needs to check that src is non-directory *and* use
{un,}lock_two_nodirectories().  As it is, it's trivial to cause
double-lock (ioctl(fd, CIFS_IOC_COPYCHUNK_FILE, fd)) and if the
last argument is an fd of directory, we are asking for trouble
by violating the locking order - all directories go before all
non-directories.  If the last argument is an fd of parent
directory, it has 50% odds of locking child before parent,
which will cause AB-BA deadlock if we race with unlink().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/ioctl.c