fat: convert to unlocked_ioctl
FAT does not require the BKL in its ioctl function, which is already serialized through a mutex. Since we're already touching the ioctl code, also fix the missing handling of FAT_IOCTL_GET_ATTRIBUTES in the compat code. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
This commit is contained in:
Родитель
1bdb6f9199
Коммит
7845bc3e13
11
fs/fat/dir.c
11
fs/fat/dir.c
|
@ -753,9 +753,10 @@ static int fat_ioctl_readdir(struct inode *inode, struct file *filp,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fat_dir_ioctl(struct inode *inode, struct file *filp,
|
static long fat_dir_ioctl(struct file *filp, unsigned int cmd,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
|
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||||
struct __fat_dirent __user *d1 = (struct __fat_dirent __user *)arg;
|
struct __fat_dirent __user *d1 = (struct __fat_dirent __user *)arg;
|
||||||
int short_only, both;
|
int short_only, both;
|
||||||
|
|
||||||
|
@ -769,7 +770,7 @@ static int fat_dir_ioctl(struct inode *inode, struct file *filp,
|
||||||
both = 1;
|
both = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return fat_generic_ioctl(inode, filp, cmd, arg);
|
return fat_generic_ioctl(filp, cmd, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!access_ok(VERIFY_WRITE, d1, sizeof(struct __fat_dirent[2])))
|
if (!access_ok(VERIFY_WRITE, d1, sizeof(struct __fat_dirent[2])))
|
||||||
|
@ -809,7 +810,7 @@ static long fat_compat_dir_ioctl(struct file *filp, unsigned cmd,
|
||||||
both = 1;
|
both = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return fat_generic_ioctl(filp, cmd, (unsigned long)arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!access_ok(VERIFY_WRITE, d1, sizeof(struct compat_dirent[2])))
|
if (!access_ok(VERIFY_WRITE, d1, sizeof(struct compat_dirent[2])))
|
||||||
|
@ -831,7 +832,7 @@ const struct file_operations fat_dir_operations = {
|
||||||
.llseek = generic_file_llseek,
|
.llseek = generic_file_llseek,
|
||||||
.read = generic_read_dir,
|
.read = generic_read_dir,
|
||||||
.readdir = fat_readdir,
|
.readdir = fat_readdir,
|
||||||
.ioctl = fat_dir_ioctl,
|
.unlocked_ioctl = fat_dir_ioctl,
|
||||||
#ifdef CONFIG_COMPAT
|
#ifdef CONFIG_COMPAT
|
||||||
.compat_ioctl = fat_compat_dir_ioctl,
|
.compat_ioctl = fat_compat_dir_ioctl,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -298,8 +298,8 @@ extern int fat_free_clusters(struct inode *inode, int cluster);
|
||||||
extern int fat_count_free_clusters(struct super_block *sb);
|
extern int fat_count_free_clusters(struct super_block *sb);
|
||||||
|
|
||||||
/* fat/file.c */
|
/* fat/file.c */
|
||||||
extern int fat_generic_ioctl(struct inode *inode, struct file *filp,
|
extern long fat_generic_ioctl(struct file *filp, unsigned int cmd,
|
||||||
unsigned int cmd, unsigned long arg);
|
unsigned long arg);
|
||||||
extern const struct file_operations fat_file_operations;
|
extern const struct file_operations fat_file_operations;
|
||||||
extern const struct inode_operations fat_file_inode_operations;
|
extern const struct inode_operations fat_file_inode_operations;
|
||||||
extern int fat_setattr(struct dentry * dentry, struct iattr * attr);
|
extern int fat_setattr(struct dentry * dentry, struct iattr * attr);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <linux/capability.h>
|
#include <linux/capability.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
#include <linux/compat.h>
|
||||||
#include <linux/mount.h>
|
#include <linux/mount.h>
|
||||||
#include <linux/time.h>
|
#include <linux/time.h>
|
||||||
#include <linux/buffer_head.h>
|
#include <linux/buffer_head.h>
|
||||||
|
@ -114,9 +115,9 @@ out:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fat_generic_ioctl(struct inode *inode, struct file *filp,
|
long fat_generic_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||||
unsigned int cmd, unsigned long arg)
|
|
||||||
{
|
{
|
||||||
|
struct inode *inode = filp->f_path.dentry->d_inode;
|
||||||
u32 __user *user_attr = (u32 __user *)arg;
|
u32 __user *user_attr = (u32 __user *)arg;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
@ -129,6 +130,15 @@ int fat_generic_ioctl(struct inode *inode, struct file *filp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_COMPAT
|
||||||
|
static long fat_generic_compat_ioctl(struct file *filp, unsigned int cmd,
|
||||||
|
unsigned long arg)
|
||||||
|
|
||||||
|
{
|
||||||
|
return fat_generic_ioctl(filp, cmd, (unsigned long)compat_ptr(arg));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int fat_file_release(struct inode *inode, struct file *filp)
|
static int fat_file_release(struct inode *inode, struct file *filp)
|
||||||
{
|
{
|
||||||
if ((filp->f_mode & FMODE_WRITE) &&
|
if ((filp->f_mode & FMODE_WRITE) &&
|
||||||
|
@ -159,7 +169,10 @@ const struct file_operations fat_file_operations = {
|
||||||
.aio_write = generic_file_aio_write,
|
.aio_write = generic_file_aio_write,
|
||||||
.mmap = generic_file_mmap,
|
.mmap = generic_file_mmap,
|
||||||
.release = fat_file_release,
|
.release = fat_file_release,
|
||||||
.ioctl = fat_generic_ioctl,
|
.unlocked_ioctl = fat_generic_ioctl,
|
||||||
|
#ifdef CONFIG_COMPAT
|
||||||
|
.compat_ioctl = fat_generic_compat_ioctl,
|
||||||
|
#endif
|
||||||
.fsync = fat_file_fsync,
|
.fsync = fat_file_fsync,
|
||||||
.splice_read = generic_file_splice_read,
|
.splice_read = generic_file_splice_read,
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче