From: Al Viro Date: Mon, 19 Jan 2015 04:37:32 +0000 (-0500) Subject: fix deadlock in cifs_ioctl_clone() X-Git-Tag: fixes-v4.0-rc1~247^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=378ff1a53b5724f3ac97b0aba3c9ecac072f6fcd;p=pandora-kernel.git fix deadlock in cifs_ioctl_clone() 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(). Cc: stable@vger.kernel.org @ 3.13+ Signed-off-by: Al Viro --- Reading git-diff-tree failed