Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/viro/vfs

Pull vfs updates from Al Viro:
 "The big thing in this pile is Eric's unmount-on-rmdir series; we
  finally have everything we need for that.  The final piece of prereqs
  is delayed mntput() - now filesystem shutdown always happens on
  shallow stack.

  Other than that, we have several new primitives for iov_iter (Matt
  Wilcox, culled from his XIP-related series) pushing the conversion to
  ->read_iter()/ ->write_iter() a bit more, a bunch of fs/dcache.c
  cleanups and fixes (including the external name refcounting, which
  gives consistent behaviour of d_move() wrt procfs symlinks for long
  and short names alike) and assorted cleanups and fixes all over the
  place.

  This is just the first pile; there's a lot of stuff from various
  people that ought to go in this window.  Starting with
  unionmount/overlayfs mess...  ;-/"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (60 commits)
  fs/file_table.c: Update alloc_file() comment
  vfs: Deduplicate code shared by xattr system calls operating on paths
  reiserfs: remove pointless forward declaration of struct nameidata
  don't need that forward declaration of struct nameidata in dcache.h anymore
  take dname_external() into fs/dcache.c
  let path_init() failures treated the same way as subsequent link_path_walk()
  fix misuses of f_count() in ppp and netlink
  ncpfs: use list_for_each_entry() for d_subdirs walk
  vfs: move getname() from callers to do_mount()
  gfs2_atomic_open(): skip lookups on hashed dentry
  [infiniband] remove pointless assignments
  gadgetfs: saner API for gadgetfs_create_file()
  f_fs: saner API for ffs_sb_create_file()
  jfs: don't hash direct inode
  [s390] remove pointless assignment of ->f_op in vmlogrdr ->open()
  ecryptfs: ->f_op is never NULL
  android: ->f_op is never NULL
  nouveau: __iomem misannotations
  missing annotation in fs/file.c
  fs: namespace: suppress 'may be used uninitialized' warnings
  ...
  • Loading branch information
torvalds committed Oct 13, 2014
2 parents 5e40d33 + a457606 commit 77c688a
Show file tree
Hide file tree
Showing 74 changed files with 889 additions and 960 deletions.
2 changes: 1 addition & 1 deletion Documentation/filesystems/vfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ noted. This means that most methods can block safely. All methods are
only called from a process context (i.e. not from an interrupt handler
or bottom half).

alloc_inode: this method is called by inode_alloc() to allocate memory
alloc_inode: this method is called by alloc_inode() to allocate memory
for struct inode and initialize it. If this function is not
defined, a simple 'struct inode' is allocated. Normally
alloc_inode will be used to allocate a larger structure which
Expand Down
23 changes: 10 additions & 13 deletions arch/alpha/kernel/osf_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ struct procfs_args {
* unhappy with OSF UFS. [CHECKME]
*/
static int
osf_ufs_mount(const char *dirname, struct ufs_args __user *args, int flags)
osf_ufs_mount(const char __user *dirname,
struct ufs_args __user *args, int flags)
{
int retval;
struct cdfs_args tmp;
Expand All @@ -466,7 +467,8 @@ osf_ufs_mount(const char *dirname, struct ufs_args __user *args, int flags)
}

static int
osf_cdfs_mount(const char *dirname, struct cdfs_args __user *args, int flags)
osf_cdfs_mount(const char __user *dirname,
struct cdfs_args __user *args, int flags)
{
int retval;
struct cdfs_args tmp;
Expand All @@ -486,7 +488,8 @@ osf_cdfs_mount(const char *dirname, struct cdfs_args __user *args, int flags)
}

static int
osf_procfs_mount(const char *dirname, struct procfs_args __user *args, int flags)
osf_procfs_mount(const char __user *dirname,
struct procfs_args __user *args, int flags)
{
struct procfs_args tmp;

Expand All @@ -500,28 +503,22 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path,
int, flag, void __user *, data)
{
int retval;
struct filename *name;

name = getname(path);
retval = PTR_ERR(name);
if (IS_ERR(name))
goto out;
switch (typenr) {
case 1:
retval = osf_ufs_mount(name->name, data, flag);
retval = osf_ufs_mount(path, data, flag);
break;
case 6:
retval = osf_cdfs_mount(name->name, data, flag);
retval = osf_cdfs_mount(path, data, flag);
break;
case 9:
retval = osf_procfs_mount(name->name, data, flag);
retval = osf_procfs_mount(path, data, flag);
break;
default:
retval = -EINVAL;
printk("osf_mount(%ld, %x)\n", typenr, flag);
}
putname(name);
out:

return retval;
}

Expand Down
21 changes: 5 additions & 16 deletions arch/x86/ia32/ia32_aout.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,8 @@ static int load_aout_binary(struct linux_binprm *bprm)
(current->mm->start_brk = N_BSSADDR(ex));

retval = setup_arg_pages(bprm, IA32_STACK_TOP, EXSTACK_DEFAULT);
if (retval < 0) {
/* Someone check-me: is this error path enough? */
send_sig(SIGKILL, current, 0);
if (retval < 0)
return retval;
}

install_exec_creds(bprm);

Expand All @@ -324,17 +321,13 @@ static int load_aout_binary(struct linux_binprm *bprm)

error = vm_brk(text_addr & PAGE_MASK, map_size);

if (error != (text_addr & PAGE_MASK)) {
send_sig(SIGKILL, current, 0);
if (error != (text_addr & PAGE_MASK))
return error;
}

error = read_code(bprm->file, text_addr, 32,
ex.a_text + ex.a_data);
if ((signed long)error < 0) {
send_sig(SIGKILL, current, 0);
if ((signed long)error < 0)
return error;
}
} else {
#ifdef WARN_OLD
static unsigned long error_time, error_time2;
Expand Down Expand Up @@ -368,20 +361,16 @@ static int load_aout_binary(struct linux_binprm *bprm)
MAP_EXECUTABLE | MAP_32BIT,
fd_offset);

if (error != N_TXTADDR(ex)) {
send_sig(SIGKILL, current, 0);
if (error != N_TXTADDR(ex))
return error;
}

error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data,
PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE |
MAP_EXECUTABLE | MAP_32BIT,
fd_offset + ex.a_text);
if (error != N_DATADDR(ex)) {
send_sig(SIGKILL, current, 0);
if (error != N_DATADDR(ex))
return error;
}
}
beyond_if:
set_binfmt(&aout_format);
Expand Down
81 changes: 16 additions & 65 deletions drivers/block/rsxx/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@ static DEFINE_SPINLOCK(rsxx_ida_lock);

/* --------------------Debugfs Setup ------------------- */

struct rsxx_cram {
u32 f_pos;
u32 offset;
void *i_private;
};

static int rsxx_attr_pci_regs_show(struct seq_file *m, void *p)
{
struct rsxx_cardinfo *card = m->private;
Expand Down Expand Up @@ -184,93 +178,50 @@ static int rsxx_attr_pci_regs_open(struct inode *inode, struct file *file)
static ssize_t rsxx_cram_read(struct file *fp, char __user *ubuf,
size_t cnt, loff_t *ppos)
{
struct rsxx_cram *info = fp->private_data;
struct rsxx_cardinfo *card = info->i_private;
struct rsxx_cardinfo *card = file_inode(fp)->i_private;
char *buf;
int st;
ssize_t st;

buf = kzalloc(sizeof(*buf) * cnt, GFP_KERNEL);
buf = kzalloc(cnt, GFP_KERNEL);
if (!buf)
return -ENOMEM;

info->f_pos = (u32)*ppos + info->offset;

st = rsxx_creg_read(card, CREG_ADD_CRAM + info->f_pos, cnt, buf, 1);
if (st)
return st;

st = copy_to_user(ubuf, buf, cnt);
st = rsxx_creg_read(card, CREG_ADD_CRAM + (u32)*ppos, cnt, buf, 1);
if (!st)
st = copy_to_user(ubuf, buf, cnt);
kfree(buf);
if (st)
return st;

info->offset += cnt;

kfree(buf);

*ppos += cnt;
return cnt;
}

static ssize_t rsxx_cram_write(struct file *fp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
{
struct rsxx_cram *info = fp->private_data;
struct rsxx_cardinfo *card = info->i_private;
struct rsxx_cardinfo *card = file_inode(fp)->i_private;
char *buf;
int st;
ssize_t st;

buf = kzalloc(sizeof(*buf) * cnt, GFP_KERNEL);
buf = kzalloc(cnt, GFP_KERNEL);
if (!buf)
return -ENOMEM;

st = copy_from_user(buf, ubuf, cnt);
if (!st)
st = rsxx_creg_write(card, CREG_ADD_CRAM + (u32)*ppos, cnt,
buf, 1);
kfree(buf);
if (st)
return st;

info->f_pos = (u32)*ppos + info->offset;

st = rsxx_creg_write(card, CREG_ADD_CRAM + info->f_pos, cnt, buf, 1);
if (st)
return st;

info->offset += cnt;

kfree(buf);

*ppos += cnt;
return cnt;
}

static int rsxx_cram_open(struct inode *inode, struct file *file)
{
struct rsxx_cram *info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;

info->i_private = inode->i_private;
info->f_pos = file->f_pos;
file->private_data = info;

return 0;
}

static int rsxx_cram_release(struct inode *inode, struct file *file)
{
struct rsxx_cram *info = file->private_data;

if (!info)
return 0;

kfree(info);
file->private_data = NULL;

return 0;
}

static const struct file_operations debugfs_cram_fops = {
.owner = THIS_MODULE,
.open = rsxx_cram_open,
.read = rsxx_cram_read,
.write = rsxx_cram_write,
.release = rsxx_cram_release,
};

static const struct file_operations debugfs_stats_fops = {
Expand Down
22 changes: 8 additions & 14 deletions drivers/bluetooth/hci_vhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,11 @@ static int vhci_create_device(struct vhci_data *data, __u8 opcode)
}

static inline ssize_t vhci_get_user(struct vhci_data *data,
const struct iovec *iov,
unsigned long count)
struct iov_iter *from)
{
size_t len = iov_length(iov, count);
size_t len = iov_iter_count(from);
struct sk_buff *skb;
__u8 pkt_type, opcode;
unsigned long i;
int ret;

if (len < 2 || len > HCI_MAX_FRAME_SIZE)
Expand All @@ -176,12 +174,9 @@ static inline ssize_t vhci_get_user(struct vhci_data *data,
if (!skb)
return -ENOMEM;

for (i = 0; i < count; i++) {
if (copy_from_user(skb_put(skb, iov[i].iov_len),
iov[i].iov_base, iov[i].iov_len)) {
kfree_skb(skb);
return -EFAULT;
}
if (copy_from_iter(skb_put(skb, len), len, from) != len) {
kfree_skb(skb);
return -EFAULT;
}

pkt_type = *((__u8 *) skb->data);
Expand Down Expand Up @@ -294,13 +289,12 @@ static ssize_t vhci_read(struct file *file,
return ret;
}

static ssize_t vhci_write(struct kiocb *iocb, const struct iovec *iov,
unsigned long count, loff_t pos)
static ssize_t vhci_write(struct kiocb *iocb, struct iov_iter *from)
{
struct file *file = iocb->ki_filp;
struct vhci_data *data = file->private_data;

return vhci_get_user(data, iov, count);
return vhci_get_user(data, from);
}

static unsigned int vhci_poll(struct file *file, poll_table *wait)
Expand Down Expand Up @@ -365,7 +359,7 @@ static int vhci_release(struct inode *inode, struct file *file)
static const struct file_operations vhci_fops = {
.owner = THIS_MODULE,
.read = vhci_read,
.aio_write = vhci_write,
.write_iter = vhci_write,
.poll = vhci_poll,
.open = vhci_open,
.release = vhci_release,
Expand Down
Loading

0 comments on commit 77c688a

Please sign in to comment.