aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-05 11:50:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-05 11:50:26 -0400
commit45d9a2220f6004b47c362cc7fc7cf9a73cb6353a (patch)
tree4e2217464c5cd71674a6ffff1f3dddaeb52556b7 /kernel
parent2386a3b0fbb0c2dcf29694c7df9a72cb268458f0 (diff)
parent02afc27faec94c9e068517a22acf55400976c698 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs pile 1 from Al Viro: "Unfortunately, this merge window it'll have a be a lot of small piles - my fault, actually, for not keeping #for-next in anything that would resemble a sane shape ;-/ This pile: assorted fixes (the first 3 are -stable fodder, IMO) and cleanups + %pd/%pD formats (dentry/file pathname, up to 4 last components) + several long-standing patches from various folks. There definitely will be a lot more (starting with Miklos' check_submount_and_drop() series)" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (26 commits) direct-io: Handle O_(D)SYNC AIO direct-io: Implement generic deferred AIO completions add formats for dentry/file pathnames kvm eventfd: switch to fdget powerpc kvm: use fdget switch fchmod() to fdget switch epoll_ctl() to fdget switch copy_module_from_fd() to fdget git simplify nilfs check for busy subtree ibmasmfs: don't bother passing superblock when not needed don't pass superblock to hypfs_{mkdir,create*} don't pass superblock to hypfs_diag_create_files don't pass superblock to hypfs_vm_create_files() oprofile: get rid of pointless forward declarations of struct super_block oprofilefs_create_...() do not need superblock argument oprofilefs_mkdir() doesn't need superblock argument don't bother with passing superblock to oprofile_create_stats_files() oprofile: don't bother with passing superblock to ->create_files() don't bother passing sb to oprofile_create_files() coh901318: don't open-code simple_read_from_buffer() ...
Diffstat (limited to 'kernel')
-rw-r--r--kernel/module.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 9f5ddae72f44..dc582749fa13 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2549,21 +2549,20 @@ static int copy_module_from_user(const void __user *umod, unsigned long len,
2549/* Sets info->hdr and info->len. */ 2549/* Sets info->hdr and info->len. */
2550static int copy_module_from_fd(int fd, struct load_info *info) 2550static int copy_module_from_fd(int fd, struct load_info *info)
2551{ 2551{
2552 struct file *file; 2552 struct fd f = fdget(fd);
2553 int err; 2553 int err;
2554 struct kstat stat; 2554 struct kstat stat;
2555 loff_t pos; 2555 loff_t pos;
2556 ssize_t bytes = 0; 2556 ssize_t bytes = 0;
2557 2557
2558 file = fget(fd); 2558 if (!f.file)
2559 if (!file)
2560 return -ENOEXEC; 2559 return -ENOEXEC;
2561 2560
2562 err = security_kernel_module_from_file(file); 2561 err = security_kernel_module_from_file(f.file);
2563 if (err) 2562 if (err)
2564 goto out; 2563 goto out;
2565 2564
2566 err = vfs_getattr(&file->f_path, &stat); 2565 err = vfs_getattr(&f.file->f_path, &stat);
2567 if (err) 2566 if (err)
2568 goto out; 2567 goto out;
2569 2568
@@ -2586,7 +2585,7 @@ static int copy_module_from_fd(int fd, struct load_info *info)
2586 2585
2587 pos = 0; 2586 pos = 0;
2588 while (pos < stat.size) { 2587 while (pos < stat.size) {
2589 bytes = kernel_read(file, pos, (char *)(info->hdr) + pos, 2588 bytes = kernel_read(f.file, pos, (char *)(info->hdr) + pos,
2590 stat.size - pos); 2589 stat.size - pos);
2591 if (bytes < 0) { 2590 if (bytes < 0) {
2592 vfree(info->hdr); 2591 vfree(info->hdr);
@@ -2600,7 +2599,7 @@ static int copy_module_from_fd(int fd, struct load_info *info)
2600 info->len = pos; 2599 info->len = pos;
2601 2600
2602out: 2601out:
2603 fput(file); 2602 fdput(f);
2604 return err; 2603 return err;
2605} 2604}
2606 2605