ncpfs: return proper error from NCP_IOC_SETROOT ioctl
authorJan Kara <jack@suse.cz>
Wed, 10 Dec 2014 23:52:22 +0000 (15:52 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 20 Feb 2015 00:49:30 +0000 (00:49 +0000)
commit a682e9c28cac152e6e54c39efcf046e0c8cfcf63 upstream.

If some error happens in NCP_IOC_SETROOT ioctl, the appropriate error
return value is then (in most cases) just overwritten before we return.
This can result in reporting success to userspace although error happened.

This bug was introduced by commit 2e54eb96e2c8 ("BKL: Remove BKL from
ncpfs").  Propagate the errors correctly.

Coverity id: 1226925.

Fixes: 2e54eb96e2c80 ("BKL: Remove BKL from ncpfs")
Signed-off-by: Jan Kara <jack@suse.cz>
Cc: Petr Vandrovec <petr@vandrovec.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/ncpfs/ioctl.c

index 790e92a..ea6f706 100644 (file)
@@ -445,7 +445,6 @@ static long __ncp_ioctl(struct inode *inode, unsigned int cmd, unsigned long arg
                                                result = -EIO;
                                        }
                                }
                                                result = -EIO;
                                        }
                                }
-                               result = 0;
                        }
                        mutex_unlock(&server->root_setup_lock);
 
                        }
                        mutex_unlock(&server->root_setup_lock);