mirror of
https://github.com/torvalds/linux.git
synced 2026-05-12 16:18:45 +02:00
VFS-related cleanups in various places (mostly of the "that really can't
happen" or "there's a better way to do it" variety) -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQQqUNBr3gm4hGXdBJlZ7Krx/gZQ6wUCaIRK0QAKCRBZ7Krx/gZQ 66/LAPoCvj5nAZH41F1VfyinA6V96kKsAazjrG7ttpWenu+6GAD/e9YQIAtYro0Z 6f6EWTgrrEZqpOgc9kfHJq60m/TnSg8= =Ojq4 -----END PGP SIGNATURE----- Merge tag 'pull-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs Pull misc VFS updates from Al Viro: "VFS-related cleanups in various places (mostly of the "that really can't happen" or "there's a better way to do it" variety)" * tag 'pull-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: gpib: use file_inode() binder_ioctl_write_read(): simplify control flow a bit secretmem: move setting O_LARGEFILE and bumping users' count to the place where we create the file apparmor: file never has NULL f_path.mnt landlock: opened file never has a negative dentry
This commit is contained in:
commit
2d9c1336ed
|
|
@ -5384,10 +5384,9 @@ static int binder_ioctl_write_read(struct file *filp, unsigned long arg,
|
|||
void __user *ubuf = (void __user *)arg;
|
||||
struct binder_write_read bwr;
|
||||
|
||||
if (copy_from_user(&bwr, ubuf, sizeof(bwr))) {
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
if (copy_from_user(&bwr, ubuf, sizeof(bwr)))
|
||||
return -EFAULT;
|
||||
|
||||
binder_debug(BINDER_DEBUG_READ_WRITE,
|
||||
"%d:%d write %lld at %016llx, read %lld at %016llx\n",
|
||||
proc->pid, thread->pid,
|
||||
|
|
@ -5402,8 +5401,6 @@ static int binder_ioctl_write_read(struct file *filp, unsigned long arg,
|
|||
trace_binder_write_done(ret);
|
||||
if (ret < 0) {
|
||||
bwr.read_consumed = 0;
|
||||
if (copy_to_user(ubuf, &bwr, sizeof(bwr)))
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
|
@ -5417,22 +5414,17 @@ static int binder_ioctl_write_read(struct file *filp, unsigned long arg,
|
|||
if (!binder_worklist_empty_ilocked(&proc->todo))
|
||||
binder_wakeup_proc_ilocked(proc);
|
||||
binder_inner_proc_unlock(proc);
|
||||
if (ret < 0) {
|
||||
if (copy_to_user(ubuf, &bwr, sizeof(bwr)))
|
||||
ret = -EFAULT;
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
binder_debug(BINDER_DEBUG_READ_WRITE,
|
||||
"%d:%d wrote %lld of %lld, read return %lld of %lld\n",
|
||||
proc->pid, thread->pid,
|
||||
(u64)bwr.write_consumed, (u64)bwr.write_size,
|
||||
(u64)bwr.read_consumed, (u64)bwr.read_size);
|
||||
if (copy_to_user(ubuf, &bwr, sizeof(bwr))) {
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
out:
|
||||
if (copy_to_user(ubuf, &bwr, sizeof(bwr)))
|
||||
ret = -EFAULT;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -610,7 +610,7 @@ int ibclose(struct inode *inode, struct file *filep)
|
|||
|
||||
long ibioctl(struct file *filep, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
unsigned int minor = iminor(filep->f_path.dentry->d_inode);
|
||||
unsigned int minor = iminor(file_inode(filep));
|
||||
struct gpib_board *board;
|
||||
struct gpib_file_private *file_priv = filep->private_data;
|
||||
long retval = -ENOTTY;
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ static struct file *secretmem_file_create(unsigned long flags)
|
|||
return ERR_CAST(inode);
|
||||
|
||||
file = alloc_file_pseudo(inode, secretmem_mnt, "secretmem",
|
||||
O_RDWR, &secretmem_fops);
|
||||
O_RDWR | O_LARGEFILE, &secretmem_fops);
|
||||
if (IS_ERR(file))
|
||||
goto err_free_inode;
|
||||
|
||||
|
|
@ -215,6 +215,8 @@ static struct file *secretmem_file_create(unsigned long flags)
|
|||
inode->i_mode |= S_IFREG;
|
||||
inode->i_size = 0;
|
||||
|
||||
atomic_inc(&secretmem_users);
|
||||
|
||||
return file;
|
||||
|
||||
err_free_inode:
|
||||
|
|
@ -248,9 +250,6 @@ SYSCALL_DEFINE1(memfd_secret, unsigned int, flags)
|
|||
goto err_put_fd;
|
||||
}
|
||||
|
||||
file->f_flags |= O_LARGEFILE;
|
||||
|
||||
atomic_inc(&secretmem_users);
|
||||
fd_install(fd, file);
|
||||
return fd;
|
||||
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ int aa_file_perm(const char *op, const struct cred *subj_cred,
|
|||
rcu_read_unlock();
|
||||
/* TODO: label cross check */
|
||||
|
||||
if (file->f_path.mnt && path_mediated_fs(file->f_path.dentry))
|
||||
if (path_mediated_fs(file->f_path.dentry))
|
||||
error = __file_path_perm(op, subj_cred, label, flabel, file,
|
||||
request, denied, in_atomic);
|
||||
|
||||
|
|
|
|||
|
|
@ -303,7 +303,6 @@ static int get_path_from_fd(const s32 fd, struct path *const path)
|
|||
if ((fd_file(f)->f_op == &ruleset_fops) ||
|
||||
(fd_file(f)->f_path.mnt->mnt_flags & MNT_INTERNAL) ||
|
||||
(fd_file(f)->f_path.dentry->d_sb->s_flags & SB_NOUSER) ||
|
||||
d_is_negative(fd_file(f)->f_path.dentry) ||
|
||||
IS_PRIVATE(d_backing_inode(fd_file(f)->f_path.dentry)))
|
||||
return -EBADFD;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user