diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 23:25:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-02 23:25:04 -0400 |
commit | aab174f0df5d72d31caccf281af5f614fa254578 (patch) | |
tree | 2a172c5009c4ac8755e858593154c258ce7709a0 /fs/compat_ioctl.c | |
parent | ca41cc96b2813221b05af57d0355157924de5a07 (diff) | |
parent | 2bd2c1941f141ad780135ccc1cd08ca71a24f10a (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs update from Al Viro:
- big one - consolidation of descriptor-related logics; almost all of
that is moved to fs/file.c
(BTW, I'm seriously tempted to rename the result to fd.c. As it is,
we have a situation when file_table.c is about handling of struct
file and file.c is about handling of descriptor tables; the reasons
are historical - file_table.c used to be about a static array of
struct file we used to have way back).
A lot of stray ends got cleaned up and converted to saner primitives,
disgusting mess in android/binder.c is still disgusting, but at least
doesn't poke so much in descriptor table guts anymore. A bunch of
relatively minor races got fixed in process, plus an ext4 struct file
leak.
- related thing - fget_light() partially unuglified; see fdget() in
there (and yes, it generates the code as good as we used to have).
- also related - bits of Cyrill's procfs stuff that got entangled into
that work; _not_ all of it, just the initial move to fs/proc/fd.c and
switch of fdinfo to seq_file.
- Alex's fs/coredump.c spiltoff - the same story, had been easier to
take that commit than mess with conflicts. The rest is a separate
pile, this was just a mechanical code movement.
- a few misc patches all over the place. Not all for this cycle,
there'll be more (and quite a few currently sit in akpm's tree)."
Fix up trivial conflicts in the android binder driver, and some fairly
simple conflicts due to two different changes to the sock_alloc_file()
interface ("take descriptor handling from sock_alloc_file() to callers"
vs "net: Providing protocol type via system.sockprotoname xattr of
/proc/PID/fd entries" adding a dentry name to the socket)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (72 commits)
MAX_LFS_FILESIZE should be a loff_t
compat: fs: Generic compat_sys_sendfile implementation
fs: push rcu_barrier() from deactivate_locked_super() to filesystems
btrfs: reada_extent doesn't need kref for refcount
coredump: move core dump functionality into its own file
coredump: prevent double-free on an error path in core dumper
usb/gadget: fix misannotations
fcntl: fix misannotations
ceph: don't abuse d_delete() on failure exits
hypfs: ->d_parent is never NULL or negative
vfs: delete surplus inode NULL check
switch simple cases of fget_light to fdget
new helpers: fdget()/fdput()
switch o2hb_region_dev_write() to fget_light()
proc_map_files_readdir(): don't bother with grabbing files
make get_file() return its argument
vhost_set_vring(): turn pollstart/pollstop into bool
switch prctl_set_mm_exe_file() to fget_light()
switch xfs_find_handle() to fget_light()
switch xfs_swapext() to fget_light()
...
Diffstat (limited to 'fs/compat_ioctl.c')
-rw-r--r-- | fs/compat_ioctl.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 9c03a3ae898f..f5054025f9da 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -1539,16 +1539,13 @@ static int compat_ioctl_check_table(unsigned int xcmd) | |||
1539 | asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, | 1539 | asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, |
1540 | unsigned long arg) | 1540 | unsigned long arg) |
1541 | { | 1541 | { |
1542 | struct file *filp; | 1542 | struct fd f = fdget(fd); |
1543 | int error = -EBADF; | 1543 | int error = -EBADF; |
1544 | int fput_needed; | 1544 | if (!f.file) |
1545 | |||
1546 | filp = fget_light(fd, &fput_needed); | ||
1547 | if (!filp) | ||
1548 | goto out; | 1545 | goto out; |
1549 | 1546 | ||
1550 | /* RED-PEN how should LSM module know it's handling 32bit? */ | 1547 | /* RED-PEN how should LSM module know it's handling 32bit? */ |
1551 | error = security_file_ioctl(filp, cmd, arg); | 1548 | error = security_file_ioctl(f.file, cmd, arg); |
1552 | if (error) | 1549 | if (error) |
1553 | goto out_fput; | 1550 | goto out_fput; |
1554 | 1551 | ||
@@ -1568,30 +1565,30 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, | |||
1568 | #if defined(CONFIG_IA64) || defined(CONFIG_X86_64) | 1565 | #if defined(CONFIG_IA64) || defined(CONFIG_X86_64) |
1569 | case FS_IOC_RESVSP_32: | 1566 | case FS_IOC_RESVSP_32: |
1570 | case FS_IOC_RESVSP64_32: | 1567 | case FS_IOC_RESVSP64_32: |
1571 | error = compat_ioctl_preallocate(filp, compat_ptr(arg)); | 1568 | error = compat_ioctl_preallocate(f.file, compat_ptr(arg)); |
1572 | goto out_fput; | 1569 | goto out_fput; |
1573 | #else | 1570 | #else |
1574 | case FS_IOC_RESVSP: | 1571 | case FS_IOC_RESVSP: |
1575 | case FS_IOC_RESVSP64: | 1572 | case FS_IOC_RESVSP64: |
1576 | error = ioctl_preallocate(filp, compat_ptr(arg)); | 1573 | error = ioctl_preallocate(f.file, compat_ptr(arg)); |
1577 | goto out_fput; | 1574 | goto out_fput; |
1578 | #endif | 1575 | #endif |
1579 | 1576 | ||
1580 | case FIBMAP: | 1577 | case FIBMAP: |
1581 | case FIGETBSZ: | 1578 | case FIGETBSZ: |
1582 | case FIONREAD: | 1579 | case FIONREAD: |
1583 | if (S_ISREG(filp->f_path.dentry->d_inode->i_mode)) | 1580 | if (S_ISREG(f.file->f_path.dentry->d_inode->i_mode)) |
1584 | break; | 1581 | break; |
1585 | /*FALL THROUGH*/ | 1582 | /*FALL THROUGH*/ |
1586 | 1583 | ||
1587 | default: | 1584 | default: |
1588 | if (filp->f_op && filp->f_op->compat_ioctl) { | 1585 | if (f.file->f_op && f.file->f_op->compat_ioctl) { |
1589 | error = filp->f_op->compat_ioctl(filp, cmd, arg); | 1586 | error = f.file->f_op->compat_ioctl(f.file, cmd, arg); |
1590 | if (error != -ENOIOCTLCMD) | 1587 | if (error != -ENOIOCTLCMD) |
1591 | goto out_fput; | 1588 | goto out_fput; |
1592 | } | 1589 | } |
1593 | 1590 | ||
1594 | if (!filp->f_op || !filp->f_op->unlocked_ioctl) | 1591 | if (!f.file->f_op || !f.file->f_op->unlocked_ioctl) |
1595 | goto do_ioctl; | 1592 | goto do_ioctl; |
1596 | break; | 1593 | break; |
1597 | } | 1594 | } |
@@ -1599,7 +1596,7 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, | |||
1599 | if (compat_ioctl_check_table(XFORM(cmd))) | 1596 | if (compat_ioctl_check_table(XFORM(cmd))) |
1600 | goto found_handler; | 1597 | goto found_handler; |
1601 | 1598 | ||
1602 | error = do_ioctl_trans(fd, cmd, arg, filp); | 1599 | error = do_ioctl_trans(fd, cmd, arg, f.file); |
1603 | if (error == -ENOIOCTLCMD) | 1600 | if (error == -ENOIOCTLCMD) |
1604 | error = -ENOTTY; | 1601 | error = -ENOTTY; |
1605 | 1602 | ||
@@ -1608,9 +1605,9 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, | |||
1608 | found_handler: | 1605 | found_handler: |
1609 | arg = (unsigned long)compat_ptr(arg); | 1606 | arg = (unsigned long)compat_ptr(arg); |
1610 | do_ioctl: | 1607 | do_ioctl: |
1611 | error = do_vfs_ioctl(filp, fd, cmd, arg); | 1608 | error = do_vfs_ioctl(f.file, fd, cmd, arg); |
1612 | out_fput: | 1609 | out_fput: |
1613 | fput_light(filp, fput_needed); | 1610 | fdput(f); |
1614 | out: | 1611 | out: |
1615 | return error; | 1612 | return error; |
1616 | } | 1613 | } |