Skip to content

Commit

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

Pull vfs update from Al Viro:
 "Part one:

   - struct filename-related cleanups

   - saner iov_iter_init() replacements (and switching the syscalls to
     use of those)

   - ntfs switch to ->write_iter() (Anton)

   - aio cleanups and splitting iocb into common and async parts
     (Christoph)

   - assorted fixes (me, bfields, Andrew Elble)

  There's a lot more, including the completion of switchover to
  ->{read,write}_iter(), d_inode/d_backing_inode annotations, f_flags
  race fixes, etc, but that goes after #for-davem merge.  David has
  pulled it, and once it's in I'll send the next vfs pull request"

* 'for-linus-1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (35 commits)
  sg_start_req(): use import_iovec()
  sg_start_req(): make sure that there's not too many elements in iovec
  blk_rq_map_user(): use import_single_range()
  sg_io(): use import_iovec()
  process_vm_access: switch to {compat_,}import_iovec()
  switch keyctl_instantiate_key_common() to iov_iter
  switch {compat_,}do_readv_writev() to {compat_,}import_iovec()
  aio_setup_vectored_rw(): switch to {compat_,}import_iovec()
  vmsplice_to_user(): switch to import_iovec()
  kill aio_setup_single_vector()
  aio: simplify arguments of aio_setup_..._rw()
  aio: lift iov_iter_init() into aio_setup_..._rw()
  lift iov_iter into {compat_,}do_readv_writev()
  NFS: fix BUG() crash in notify_change() with patch to chown_common()
  dcache: return -ESTALE not -EBUSY on distributed fs race
  NTFS: Version 2.1.32 - Update file write from aio_write to write_iter.
  VFS: Add iov_iter_fault_in_multipages_readable()
  drop bogus check in file_open_root()
  switch security_inode_getattr() to struct path *
  constify tomoyo_realpath_from_path()
  ...
  • Loading branch information
torvalds committed Apr 14, 2015
2 parents 6c8a53c + fdc81f4 commit ca2ec32
Show file tree
Hide file tree
Showing 103 changed files with 839 additions and 1,118 deletions.
2 changes: 0 additions & 2 deletions arch/arc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ int copy_thread(unsigned long clone_flags,
*/
void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long usp)
{
set_fs(USER_DS); /* user space */

regs->sp = usp;
regs->ret = pc;

Expand Down
1 change: 0 additions & 1 deletion arch/c6x/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ void start_thread(struct pt_regs *regs, unsigned int pc, unsigned long usp)
*/
usp -= 8;

set_fs(USER_DS);
regs->pc = pc;
regs->sp = usp;
regs->tsr |= 0x40; /* set user mode */
Expand Down
4 changes: 0 additions & 4 deletions arch/frv/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set)
struct sigframe __user *frame;
int rsig, sig = ksig->sig;

set_fs(USER_DS);

frame = get_sigframe(ksig, sizeof(*frame));

if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
Expand Down Expand Up @@ -257,8 +255,6 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set)
struct rt_sigframe __user *frame;
int rsig, sig = ksig->sig;

set_fs(USER_DS);

frame = get_sigframe(ksig, sizeof(*frame));

if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
Expand Down
2 changes: 0 additions & 2 deletions arch/hexagon/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@
*/
void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp)
{
/* Set to run with user-mode data segmentation */
set_fs(USER_DS);
/* We want to zero all data-containing registers. Is this overkill? */
memset(regs, 0, sizeof(*regs));
/* We might want to also zero all Processor registers here */
Expand Down
2 changes: 0 additions & 2 deletions arch/m32r/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
regs->r2 = (unsigned long)&frame->uc;
regs->bpc = (unsigned long)ksig->ka.sa.sa_handler;

set_fs(USER_DS);

#if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%p\n",
current->comm, current->pid, frame, regs->pc);
Expand Down
1 change: 0 additions & 1 deletion arch/metag/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ struct thread_struct {
*/
#define start_thread(regs, pc, usp) do { \
unsigned int *argc = (unsigned int *) bprm->exec; \
set_fs(USER_DS); \
current->thread.int_depth = 1; \
/* Force this process down to user land */ \
regs->ctx.SaveMask = TBICTX_PRIV_BIT; \
Expand Down
2 changes: 0 additions & 2 deletions arch/microblaze/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
/* Offset to handle microblaze rtid r14, 0 */
regs->pc = (unsigned long)ksig->ka.sa.sa_handler;

set_fs(USER_DS);

#ifdef DEBUG_SIG
pr_info("SIG deliver (%s:%d): sp=%p pc=%08lx\n",
current->comm, current->pid, frame, regs->pc);
Expand Down
1 change: 0 additions & 1 deletion arch/nios2/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ void show_regs(struct pt_regs *regs)

void flush_thread(void)
{
set_fs(USER_DS);
}

int copy_thread(unsigned long clone_flags,
Expand Down
1 change: 0 additions & 1 deletion arch/openrisc/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ void start_thread(struct pt_regs *regs, unsigned long pc, unsigned long sp)
{
unsigned long sr = mfspr(SPR_SR) & ~SPR_SR_SM;

set_fs(USER_DS);
memset(regs, 0, sizeof(struct pt_regs));

regs->pc = pc;
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/hypfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <linux/module.h>
#include <linux/seq_file.h>
#include <linux/mount.h>
#include <linux/aio.h>
#include <linux/uio.h>
#include <asm/ebcdic.h>
#include "hypfs.h"

Expand Down
4 changes: 0 additions & 4 deletions arch/sh/kernel/signal_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,6 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set,
if (err)
return -EFAULT;

set_fs(USER_DS);

pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
current->comm, task_pid_nr(current), frame, regs->pc, regs->pr);

Expand Down Expand Up @@ -408,8 +406,6 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
if (err)
return -EFAULT;

set_fs(USER_DS);

pr_debug("SIG deliver (%s:%d): sp=%p pc=%08lx pr=%08lx\n",
current->comm, task_pid_nr(current), frame, regs->pc, regs->pr);

Expand Down
4 changes: 0 additions & 4 deletions arch/sh/kernel/signal_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,6 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs

regs->pc = neff_sign_extend((unsigned long)ksig->ka.sa.sa_handler);

set_fs(USER_DS);

/* Broken %016Lx */
pr_debug("SIG deliver (#%d,%s:%d): sp=%p pc=%08Lx%08Lx link=%08Lx%08Lx\n",
signal, current->comm, current->pid, frame,
Expand Down Expand Up @@ -547,8 +545,6 @@ static int setup_rt_frame(struct ksignal *kig, sigset_t *set,
regs->regs[REG_ARG3] = (unsigned long long)(unsigned long)(signed long)&frame->uc.uc_mcontext;
regs->pc = neff_sign_extend((unsigned long)ksig->ka.sa.sa_handler);

set_fs(USER_DS);

pr_debug("SIG deliver (#%d,%s:%d): sp=%p pc=%08Lx%08Lx link=%08Lx%08Lx\n",
signal, current->comm, current->pid, frame,
regs->pc >> 32, regs->pc & 0xffffffff,
Expand Down
5 changes: 0 additions & 5 deletions arch/xtensa/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,6 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set,
regs->areg[8] = (unsigned long) &frame->uc;
regs->threadptr = tp;

/* Set access mode to USER_DS. Nomenclature is outdated, but
* functionality is used in uaccess.h
*/
set_fs(USER_DS);

#if DEBUG_SIG
printk("SIG rt deliver (%s:%d): signal=%d sp=%p pc=%08x\n",
current->comm, current->pid, signal, frame, regs->pc);
Expand Down
6 changes: 3 additions & 3 deletions block/blk-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ int blk_rq_map_user(struct request_queue *q, struct request *rq,
{
struct iovec iov;
struct iov_iter i;
int ret = import_single_range(rq_data_dir(rq), ubuf, len, &iov, &i);

iov.iov_base = ubuf;
iov.iov_len = len;
iov_iter_init(&i, rq_data_dir(rq), &iov, 1, len);
if (unlikely(ret < 0))
return ret;

return blk_rq_map_user_iov(q, rq, map_data, &i, gfp_mask);
}
Expand Down
12 changes: 5 additions & 7 deletions block/scsi_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,16 +335,14 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
struct iov_iter i;
struct iovec *iov = NULL;

ret = rw_copy_check_uvector(-1, hdr->dxferp, hdr->iovec_count,
0, NULL, &iov);
if (ret < 0) {
kfree(iov);
ret = import_iovec(rq_data_dir(rq),
hdr->dxferp, hdr->iovec_count,
0, &iov, &i);
if (ret < 0)
goto out_free_cdb;
}

/* SG_IO howto says that the shorter of the two wins */
iov_iter_init(&i, rq_data_dir(rq), iov, hdr->iovec_count,
min_t(unsigned, ret, hdr->dxfer_len));
iov_iter_truncate(&i, hdr->dxfer_len);

ret = blk_rq_map_user_iov(q, rq, NULL, &i, GFP_KERNEL);
kfree(iov);
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <linux/pfn.h>
#include <linux/export.h>
#include <linux/io.h>
#include <linux/aio.h>
#include <linux/uio.h>

#include <linux/uaccess.h>

Expand Down
1 change: 0 additions & 1 deletion drivers/char/tile-srom.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <linux/types.h> /* size_t */
#include <linux/proc_fs.h>
#include <linux/fcntl.h> /* O_ACCMODE */
#include <linux/aio.h>
#include <linux/pagemap.h>
#include <linux/hugetlb.h>
#include <linux/uaccess.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/infiniband/hw/ipath/ipath_file_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <linux/slab.h>
#include <linux/highmem.h>
#include <linux/io.h>
#include <linux/aio.h>
#include <linux/jiffies.h>
#include <linux/cpu.h>
#include <asm/pgtable.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/infiniband/hw/qib/qib_file_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include <linux/vmalloc.h>
#include <linux/highmem.h>
#include <linux/io.h>
#include <linux/aio.h>
#include <linux/jiffies.h>
#include <asm/pgtable.h>
#include <linux/delay.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/misc/mei/amthif.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/aio.h>
#include <linux/ioctl.h>
#include <linux/cdev.h>
#include <linux/list.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/misc/mei/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/aio.h>
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/ioctl.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/misc/mei/pci-me.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/aio.h>
#include <linux/pci.h>
#include <linux/poll.h>
#include <linux/ioctl.h>
Expand Down
15 changes: 6 additions & 9 deletions drivers/scsi/sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ static int sg_version_num = 30536; /* 2 digits for each component */
#include <linux/sched.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/aio.h>
#include <linux/errno.h>
#include <linux/mtio.h>
#include <linux/ioctl.h>
Expand All @@ -51,6 +50,7 @@ static int sg_version_num = 30536; /* 2 digits for each component */
#include <linux/mutex.h>
#include <linux/atomic.h>
#include <linux/ratelimit.h>
#include <linux/uio.h>

#include "scsi.h"
#include <scsi/scsi_dbg.h>
Expand Down Expand Up @@ -1745,17 +1745,14 @@ sg_start_req(Sg_request *srp, unsigned char *cmd)
}

if (iov_count) {
int size = sizeof(struct iovec) * iov_count;
struct iovec *iov;
struct iovec *iov = NULL;
struct iov_iter i;

iov = memdup_user(hp->dxferp, size);
if (IS_ERR(iov))
return PTR_ERR(iov);
res = import_iovec(rw, hp->dxferp, iov_count, 0, &iov, &i);
if (res < 0)
return res;

iov_iter_init(&i, rw, iov, iov_count,
min_t(size_t, hp->dxfer_len,
iov_length(iov, iov_count)));
iov_iter_truncate(&i, hp->dxfer_len);

res = blk_rq_map_user_iov(q, rq, md, &i, GFP_ATOMIC);
kfree(iov);
Expand Down
1 change: 0 additions & 1 deletion drivers/staging/unisys/include/timskmod.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/fcntl.h>
#include <linux/aio.h>
#include <linux/workqueue.h>
#include <linux/kthread.h>
#include <linux/seq_file.h>
Expand Down
6 changes: 4 additions & 2 deletions drivers/usb/gadget/function/f_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/export.h>
#include <linux/hid.h>
#include <linux/module.h>
#include <linux/uio.h>
#include <asm/unaligned.h>

#include <linux/usb/composite.h>
Expand Down Expand Up @@ -655,9 +656,10 @@ static void ffs_user_copy_worker(struct work_struct *work)
unuse_mm(io_data->mm);
}

aio_complete(io_data->kiocb, ret, ret);
io_data->kiocb->ki_complete(io_data->kiocb, ret, ret);

if (io_data->ffs->ffs_eventfd && !io_data->kiocb->ki_eventfd)
if (io_data->ffs->ffs_eventfd &&
!(io_data->kiocb->ki_flags & IOCB_EVENTFD))
eventfd_signal(io_data->ffs->ffs_eventfd, 1);

usb_ep_free_request(io_data->ep, io_data->req);
Expand Down
6 changes: 4 additions & 2 deletions drivers/usb/gadget/legacy/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/poll.h>
#include <linux/mmu_context.h>
#include <linux/aio.h>
#include <linux/uio.h>

#include <linux/device.h>
#include <linux/moduleparam.h>
Expand Down Expand Up @@ -469,7 +470,7 @@ static void ep_user_copy_worker(struct work_struct *work)
ret = -EFAULT;

/* completing the iocb can drop the ctx and mm, don't touch mm after */
aio_complete(iocb, ret, ret);
iocb->ki_complete(iocb, ret, ret);

kfree(priv->buf);
kfree(priv->to_free);
Expand Down Expand Up @@ -497,7 +498,8 @@ static void ep_aio_complete(struct usb_ep *ep, struct usb_request *req)
kfree(priv);
iocb->private = NULL;
/* aio_complete() reports bytes-transferred _and_ faults */
aio_complete(iocb, req->actual ? req->actual : req->status,

iocb->ki_complete(iocb, req->actual ? req->actual : req->status,
req->status);
} else {
/* ep_copy_to_user() won't report both; we hide some faults */
Expand Down
2 changes: 1 addition & 1 deletion fs/9p/vfs_addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <linux/pagemap.h>
#include <linux/idr.h>
#include <linux/sched.h>
#include <linux/aio.h>
#include <linux/uio.h>
#include <net/9p/9p.h>
#include <net/9p/client.h>

Expand Down
2 changes: 1 addition & 1 deletion fs/affs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* affs regular file handling primitives
*/

#include <linux/aio.h>
#include <linux/uio.h>
#include "affs.h"

static struct buffer_head *affs_get_extblock_slow(struct inode *inode, u32 ext);
Expand Down
1 change: 0 additions & 1 deletion fs/afs/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <linux/pagemap.h>
#include <linux/writeback.h>
#include <linux/pagevec.h>
#include <linux/aio.h>
#include "internal.h"

static int afs_write_back_from_locked_page(struct afs_writeback *wb,
Expand Down
Loading

0 comments on commit ca2ec32

Please sign in to comment.