• Al Viro's avatar
    fix deadlock in cifs_ioctl_clone() · 0fd895b3
    Al Viro authored
    commit 378ff1a5 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: default avatarAl Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
    0fd895b3
ioctl.c 6.13 KB