diff options
Diffstat (limited to 'fs/ncpfs/ioctl.c')
-rw-r--r-- | fs/ncpfs/ioctl.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index 60a5e2864ea8..84a8cfc4e38e 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c | |||
@@ -261,9 +261,9 @@ ncp_get_charsets(struct ncp_server* server, struct ncp_nls_ioctl __user *arg) | |||
261 | } | 261 | } |
262 | #endif /* CONFIG_NCPFS_NLS */ | 262 | #endif /* CONFIG_NCPFS_NLS */ |
263 | 263 | ||
264 | static int __ncp_ioctl(struct inode *inode, struct file *filp, | 264 | static long __ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
265 | unsigned int cmd, unsigned long arg) | ||
266 | { | 265 | { |
266 | struct inode *inode = filp->f_dentry->d_inode; | ||
267 | struct ncp_server *server = NCP_SERVER(inode); | 267 | struct ncp_server *server = NCP_SERVER(inode); |
268 | int result; | 268 | int result; |
269 | struct ncp_ioctl_request request; | 269 | struct ncp_ioctl_request request; |
@@ -841,11 +841,11 @@ static int ncp_ioctl_need_write(unsigned int cmd) | |||
841 | } | 841 | } |
842 | } | 842 | } |
843 | 843 | ||
844 | int ncp_ioctl(struct inode *inode, struct file *filp, | 844 | long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
845 | unsigned int cmd, unsigned long arg) | ||
846 | { | 845 | { |
847 | int ret; | 846 | long ret; |
848 | 847 | ||
848 | lock_kernel(); | ||
849 | if (ncp_ioctl_need_write(cmd)) { | 849 | if (ncp_ioctl_need_write(cmd)) { |
850 | /* | 850 | /* |
851 | * inside the ioctl(), any failures which | 851 | * inside the ioctl(), any failures which |
@@ -853,24 +853,28 @@ int ncp_ioctl(struct inode *inode, struct file *filp, | |||
853 | * -EACCESS, so it seems consistent to keep | 853 | * -EACCESS, so it seems consistent to keep |
854 | * that here. | 854 | * that here. |
855 | */ | 855 | */ |
856 | if (mnt_want_write(filp->f_path.mnt)) | 856 | if (mnt_want_write(filp->f_path.mnt)) { |
857 | return -EACCES; | 857 | ret = -EACCES; |
858 | goto out; | ||
859 | } | ||
858 | } | 860 | } |
859 | ret = __ncp_ioctl(inode, filp, cmd, arg); | 861 | ret = __ncp_ioctl(filp, cmd, arg); |
860 | if (ncp_ioctl_need_write(cmd)) | 862 | if (ncp_ioctl_need_write(cmd)) |
861 | mnt_drop_write(filp->f_path.mnt); | 863 | mnt_drop_write(filp->f_path.mnt); |
864 | |||
865 | out: | ||
866 | unlock_kernel(); | ||
862 | return ret; | 867 | return ret; |
863 | } | 868 | } |
864 | 869 | ||
865 | #ifdef CONFIG_COMPAT | 870 | #ifdef CONFIG_COMPAT |
866 | long ncp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 871 | long ncp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
867 | { | 872 | { |
868 | struct inode *inode = file->f_path.dentry->d_inode; | 873 | long ret; |
869 | int ret; | ||
870 | 874 | ||
871 | lock_kernel(); | 875 | lock_kernel(); |
872 | arg = (unsigned long) compat_ptr(arg); | 876 | arg = (unsigned long) compat_ptr(arg); |
873 | ret = ncp_ioctl(inode, file, cmd, arg); | 877 | ret = ncp_ioctl(file, cmd, arg); |
874 | unlock_kernel(); | 878 | unlock_kernel(); |
875 | return ret; | 879 | return ret; |
876 | } | 880 | } |