mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc vfs updates from Al Viro: - bmap series from cmaiolino - getting rid of convolutions in copy_mount_options() (use a couple of copy_from_user() instead of the __get_user() crap) * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: saner copy_mount_options() fibmap: Reject negative block numbers fibmap: Use bmap instead of ->bmap method in ioctl_fibmap ecryptfs: drop direct calls to ->bmap cachefiles: drop direct usage of ->bmap method. fs: Enable bmap() function to properly return errors
This commit is contained in:
33
fs/ioctl.c
33
fs/ioctl.c
@@ -54,19 +54,32 @@ EXPORT_SYMBOL(vfs_ioctl);
|
||||
|
||||
static int ioctl_fibmap(struct file *filp, int __user *p)
|
||||
{
|
||||
struct address_space *mapping = filp->f_mapping;
|
||||
int res, block;
|
||||
struct inode *inode = file_inode(filp);
|
||||
int error, ur_block;
|
||||
sector_t block;
|
||||
|
||||
/* do we support this mess? */
|
||||
if (!mapping->a_ops->bmap)
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_SYS_RAWIO))
|
||||
return -EPERM;
|
||||
res = get_user(block, p);
|
||||
if (res)
|
||||
return res;
|
||||
res = mapping->a_ops->bmap(mapping, block);
|
||||
return put_user(res, p);
|
||||
|
||||
error = get_user(ur_block, p);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (ur_block < 0)
|
||||
return -EINVAL;
|
||||
|
||||
block = ur_block;
|
||||
error = bmap(inode, &block);
|
||||
|
||||
if (error)
|
||||
ur_block = 0;
|
||||
else
|
||||
ur_block = block;
|
||||
|
||||
if (put_user(ur_block, p))
|
||||
error = -EFAULT;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user