Commit 165ea0d1 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs fixes from Al Viro:
 "Fix several places that screw up cleanups after failures halfway
  through opening a file (one open-coding filp_clone_open() and getting
  it wrong, two misusing alloc_file()). That part is -stable fodder from
  the 'work.open' branch.

  And Christoph's regression fix for uapi breakage in aio series;
  include/uapi/linux/aio_abi.h shouldn't be pulling in the kernel
  definition of sigset_t, the reason for doing so in the first place had
  been bogus - there's no need to expose struct __aio_sigset in
  aio_abi.h at all"

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  aio: don't expose __aio_sigset in uapi
  ocxlflash_getfile(): fix double-iput() on alloc_file() failures
  cxl_getfile(): fix double-iput() on alloc_file() failures
  drm_mode_create_lease_ioctl(): fix open-coded filp_clone_open()
parents f88a333b 9ba546c0
...@@ -553,24 +553,13 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev, ...@@ -553,24 +553,13 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
/* Clone the lessor file to create a new file for us */ /* Clone the lessor file to create a new file for us */
DRM_DEBUG_LEASE("Allocating lease file\n"); DRM_DEBUG_LEASE("Allocating lease file\n");
path_get(&lessor_file->f_path); lessee_file = filp_clone_open(lessor_file);
lessee_file = alloc_file(&lessor_file->f_path,
lessor_file->f_mode,
fops_get(lessor_file->f_inode->i_fop));
if (IS_ERR(lessee_file)) { if (IS_ERR(lessee_file)) {
ret = PTR_ERR(lessee_file); ret = PTR_ERR(lessee_file);
goto out_lessee; goto out_lessee;
} }
/* Initialize the new file for DRM */
DRM_DEBUG_LEASE("Initializing the file with %p\n", lessee_file->f_op->open);
ret = lessee_file->f_op->open(lessee_file->f_inode, lessee_file);
if (ret)
goto out_lessee_file;
lessee_priv = lessee_file->private_data; lessee_priv = lessee_file->private_data;
/* Change the file to a master one */ /* Change the file to a master one */
drm_master_put(&lessee_priv->master); drm_master_put(&lessee_priv->master);
lessee_priv->master = lessee; lessee_priv->master = lessee;
...@@ -588,9 +577,6 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev, ...@@ -588,9 +577,6 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl succeeded\n"); DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl succeeded\n");
return 0; return 0;
out_lessee_file:
fput(lessee_file);
out_lessee: out_lessee:
drm_master_put(&lessee); drm_master_put(&lessee);
......
...@@ -103,15 +103,15 @@ static struct file *cxl_getfile(const char *name, ...@@ -103,15 +103,15 @@ static struct file *cxl_getfile(const char *name,
d_instantiate(path.dentry, inode); d_instantiate(path.dentry, inode);
file = alloc_file(&path, OPEN_FMODE(flags), fops); file = alloc_file(&path, OPEN_FMODE(flags), fops);
if (IS_ERR(file)) if (IS_ERR(file)) {
goto err_dput; path_put(&path);
goto err_fs;
}
file->f_flags = flags & (O_ACCMODE | O_NONBLOCK); file->f_flags = flags & (O_ACCMODE | O_NONBLOCK);
file->private_data = priv; file->private_data = priv;
return file; return file;
err_dput:
path_put(&path);
err_inode: err_inode:
iput(inode); iput(inode);
err_fs: err_fs:
......
...@@ -134,15 +134,14 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name, ...@@ -134,15 +134,14 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
rc = PTR_ERR(file); rc = PTR_ERR(file);
dev_err(dev, "%s: alloc_file failed rc=%d\n", dev_err(dev, "%s: alloc_file failed rc=%d\n",
__func__, rc); __func__, rc);
goto err5; path_put(&path);
goto err3;
} }
file->f_flags = flags & (O_ACCMODE | O_NONBLOCK); file->f_flags = flags & (O_ACCMODE | O_NONBLOCK);
file->private_data = priv; file->private_data = priv;
out: out:
return file; return file;
err5:
path_put(&path);
err4: err4:
iput(inode); iput(inode);
err3: err3:
......
...@@ -1896,6 +1896,11 @@ SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id, ...@@ -1896,6 +1896,11 @@ SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id,
return ret; return ret;
} }
struct __aio_sigset {
const sigset_t __user *sigmask;
size_t sigsetsize;
};
SYSCALL_DEFINE6(io_pgetevents, SYSCALL_DEFINE6(io_pgetevents,
aio_context_t, ctx_id, aio_context_t, ctx_id,
long, min_nr, long, min_nr,
......
...@@ -127,7 +127,6 @@ int do_fchownat(int dfd, const char __user *filename, uid_t user, gid_t group, ...@@ -127,7 +127,6 @@ int do_fchownat(int dfd, const char __user *filename, uid_t user, gid_t group,
extern int open_check_o_direct(struct file *f); extern int open_check_o_direct(struct file *f);
extern int vfs_open(const struct path *, struct file *, const struct cred *); extern int vfs_open(const struct path *, struct file *, const struct cred *);
extern struct file *filp_clone_open(struct file *);
/* /*
* inode.c * inode.c
......
...@@ -2420,6 +2420,7 @@ extern struct file *filp_open(const char *, int, umode_t); ...@@ -2420,6 +2420,7 @@ extern struct file *filp_open(const char *, int, umode_t);
extern struct file *file_open_root(struct dentry *, struct vfsmount *, extern struct file *file_open_root(struct dentry *, struct vfsmount *,
const char *, int, umode_t); const char *, int, umode_t);
extern struct file * dentry_open(const struct path *, int, const struct cred *); extern struct file * dentry_open(const struct path *, int, const struct cred *);
extern struct file *filp_clone_open(struct file *);
extern int filp_close(struct file *, fl_owner_t id); extern int filp_close(struct file *, fl_owner_t id);
extern struct filename *getname_flags(const char __user *, int, int *); extern struct filename *getname_flags(const char __user *, int, int *);
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#ifndef _LINUX_SYSCALLS_H #ifndef _LINUX_SYSCALLS_H
#define _LINUX_SYSCALLS_H #define _LINUX_SYSCALLS_H
struct __aio_sigset;
struct epoll_event; struct epoll_event;
struct iattr; struct iattr;
struct inode; struct inode;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/signal.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
typedef __kernel_ulong_t aio_context_t; typedef __kernel_ulong_t aio_context_t;
...@@ -110,10 +109,5 @@ struct iocb { ...@@ -110,10 +109,5 @@ struct iocb {
#undef IFBIG #undef IFBIG
#undef IFLITTLE #undef IFLITTLE
struct __aio_sigset {
const sigset_t __user *sigmask;
size_t sigsetsize;
};
#endif /* __LINUX__AIO_ABI_H */ #endif /* __LINUX__AIO_ABI_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment