diff options
| -rw-r--r-- | arch/ia64/kernel/perfmon.c | 4 | ||||
| -rw-r--r-- | drivers/base/dma-buf.c | 3 | ||||
| -rw-r--r-- | drivers/staging/omapdrm/omap_gem.c | 3 | ||||
| -rw-r--r-- | drivers/tty/tty_io.c | 9 | ||||
| -rw-r--r-- | fs/autofs4/waitq.c | 3 | ||||
| -rw-r--r-- | fs/fuse/dev.c | 3 | ||||
| -rw-r--r-- | fs/nfsd/nfs4state.c | 3 | ||||
| -rw-r--r-- | fs/proc/base.c | 3 | ||||
| -rw-r--r-- | fs/select.c | 3 | ||||
| -rw-r--r-- | include/linux/fs.h | 6 | ||||
| -rw-r--r-- | mm/fremap.c | 3 | ||||
| -rw-r--r-- | mm/mmap.c | 3 | ||||
| -rw-r--r-- | mm/nommu.c | 6 | ||||
| -rw-r--r-- | net/compat.c | 3 | ||||
| -rw-r--r-- | net/core/scm.c | 3 | ||||
| -rw-r--r-- | security/selinux/hooks.c | 3 |
16 files changed, 23 insertions, 38 deletions
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index 79826c13b8b6..ff5d4e4c3733 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
| @@ -2306,7 +2306,7 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t | |||
| 2306 | * partially initialize the vma for the sampling buffer | 2306 | * partially initialize the vma for the sampling buffer |
| 2307 | */ | 2307 | */ |
| 2308 | vma->vm_mm = mm; | 2308 | vma->vm_mm = mm; |
| 2309 | vma->vm_file = filp; | 2309 | vma->vm_file = get_file(filp); |
| 2310 | vma->vm_flags = VM_READ| VM_MAYREAD |VM_RESERVED; | 2310 | vma->vm_flags = VM_READ| VM_MAYREAD |VM_RESERVED; |
| 2311 | vma->vm_page_prot = PAGE_READONLY; /* XXX may need to change */ | 2311 | vma->vm_page_prot = PAGE_READONLY; /* XXX may need to change */ |
| 2312 | 2312 | ||
| @@ -2345,8 +2345,6 @@ pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t | |||
| 2345 | goto error; | 2345 | goto error; |
| 2346 | } | 2346 | } |
| 2347 | 2347 | ||
| 2348 | get_file(filp); | ||
| 2349 | |||
| 2350 | /* | 2348 | /* |
| 2351 | * now insert the vma in the vm list for the process, must be | 2349 | * now insert the vma in the vm list for the process, must be |
| 2352 | * done with mmap lock held | 2350 | * done with mmap lock held |
diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c index c30f3e1d0efc..460e22dee36d 100644 --- a/drivers/base/dma-buf.c +++ b/drivers/base/dma-buf.c | |||
| @@ -460,8 +460,7 @@ int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma, | |||
| 460 | if (vma->vm_file) | 460 | if (vma->vm_file) |
| 461 | fput(vma->vm_file); | 461 | fput(vma->vm_file); |
| 462 | 462 | ||
| 463 | vma->vm_file = dmabuf->file; | 463 | vma->vm_file = get_file(dmabuf->file); |
| 464 | get_file(vma->vm_file); | ||
| 465 | 464 | ||
| 466 | vma->vm_pgoff = pgoff; | 465 | vma->vm_pgoff = pgoff; |
| 467 | 466 | ||
diff --git a/drivers/staging/omapdrm/omap_gem.c b/drivers/staging/omapdrm/omap_gem.c index 3a0d035a9e03..2a6bb7f9ee68 100644 --- a/drivers/staging/omapdrm/omap_gem.c +++ b/drivers/staging/omapdrm/omap_gem.c | |||
| @@ -566,9 +566,8 @@ int omap_gem_mmap_obj(struct drm_gem_object *obj, | |||
| 566 | * in particular in the case of mmap'd dmabufs) | 566 | * in particular in the case of mmap'd dmabufs) |
| 567 | */ | 567 | */ |
| 568 | fput(vma->vm_file); | 568 | fput(vma->vm_file); |
| 569 | get_file(obj->filp); | ||
| 570 | vma->vm_pgoff = 0; | 569 | vma->vm_pgoff = 0; |
| 571 | vma->vm_file = obj->filp; | 570 | vma->vm_file = get_file(obj->filp); |
| 572 | 571 | ||
| 573 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); | 572 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); |
| 574 | } | 573 | } |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 71d95cfbabec..c7561f29d894 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
| @@ -1163,10 +1163,8 @@ ssize_t redirected_tty_write(struct file *file, const char __user *buf, | |||
| 1163 | struct file *p = NULL; | 1163 | struct file *p = NULL; |
| 1164 | 1164 | ||
| 1165 | spin_lock(&redirect_lock); | 1165 | spin_lock(&redirect_lock); |
| 1166 | if (redirect) { | 1166 | if (redirect) |
| 1167 | get_file(redirect); | 1167 | p = get_file(redirect); |
| 1168 | p = redirect; | ||
| 1169 | } | ||
| 1170 | spin_unlock(&redirect_lock); | 1168 | spin_unlock(&redirect_lock); |
| 1171 | 1169 | ||
| 1172 | if (p) { | 1170 | if (p) { |
| @@ -2246,8 +2244,7 @@ static int tioccons(struct file *file) | |||
| 2246 | spin_unlock(&redirect_lock); | 2244 | spin_unlock(&redirect_lock); |
| 2247 | return -EBUSY; | 2245 | return -EBUSY; |
| 2248 | } | 2246 | } |
| 2249 | get_file(file); | 2247 | redirect = get_file(file); |
| 2250 | redirect = file; | ||
| 2251 | spin_unlock(&redirect_lock); | 2248 | spin_unlock(&redirect_lock); |
| 2252 | return 0; | 2249 | return 0; |
| 2253 | } | 2250 | } |
diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c index da8876d38a7b..dce436e595c1 100644 --- a/fs/autofs4/waitq.c +++ b/fs/autofs4/waitq.c | |||
| @@ -175,8 +175,7 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi, | |||
| 175 | return; | 175 | return; |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | pipe = sbi->pipe; | 178 | pipe = get_file(sbi->pipe); |
| 179 | get_file(pipe); | ||
| 180 | 179 | ||
| 181 | mutex_unlock(&sbi->wq_mutex); | 180 | mutex_unlock(&sbi->wq_mutex); |
| 182 | 181 | ||
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index f4246cfc8d87..8c23fa7a91e6 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
| @@ -148,8 +148,7 @@ static struct fuse_req *get_reserved_req(struct fuse_conn *fc, | |||
| 148 | if (ff->reserved_req) { | 148 | if (ff->reserved_req) { |
| 149 | req = ff->reserved_req; | 149 | req = ff->reserved_req; |
| 150 | ff->reserved_req = NULL; | 150 | ff->reserved_req = NULL; |
| 151 | get_file(file); | 151 | req->stolen_file = get_file(file); |
| 152 | req->stolen_file = file; | ||
| 153 | } | 152 | } |
| 154 | spin_unlock(&fc->lock); | 153 | spin_unlock(&fc->lock); |
| 155 | } while (!req); | 154 | } while (!req); |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index cc894eda385a..48a1bad37334 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -2837,8 +2837,7 @@ static int nfs4_setlease(struct nfs4_delegation *dp, int flag) | |||
| 2837 | return -ENOMEM; | 2837 | return -ENOMEM; |
| 2838 | } | 2838 | } |
| 2839 | fp->fi_lease = fl; | 2839 | fp->fi_lease = fl; |
| 2840 | fp->fi_deleg_file = fl->fl_file; | 2840 | fp->fi_deleg_file = get_file(fl->fl_file); |
| 2841 | get_file(fp->fi_deleg_file); | ||
| 2842 | atomic_set(&fp->fi_delegees, 1); | 2841 | atomic_set(&fp->fi_delegees, 1); |
| 2843 | list_add(&dp->dl_perfile, &fp->fi_delegations); | 2842 | list_add(&dp->dl_perfile, &fp->fi_delegations); |
| 2844 | return 0; | 2843 | return 0; |
diff --git a/fs/proc/base.c b/fs/proc/base.c index b55c3bb298e3..f1e8438d21b5 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
| @@ -1979,8 +1979,7 @@ proc_map_files_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
| 1979 | if (++pos <= filp->f_pos) | 1979 | if (++pos <= filp->f_pos) |
| 1980 | continue; | 1980 | continue; |
| 1981 | 1981 | ||
| 1982 | get_file(vma->vm_file); | 1982 | info.file = get_file(vma->vm_file); |
| 1983 | info.file = vma->vm_file; | ||
| 1984 | info.len = snprintf(info.name, | 1983 | info.len = snprintf(info.name, |
| 1985 | sizeof(info.name), "%lx-%lx", | 1984 | sizeof(info.name), "%lx-%lx", |
| 1986 | vma->vm_start, vma->vm_end); | 1985 | vma->vm_start, vma->vm_end); |
diff --git a/fs/select.c b/fs/select.c index db14c781335e..ffdd16d6e691 100644 --- a/fs/select.c +++ b/fs/select.c | |||
| @@ -220,8 +220,7 @@ static void __pollwait(struct file *filp, wait_queue_head_t *wait_address, | |||
| 220 | struct poll_table_entry *entry = poll_get_entry(pwq); | 220 | struct poll_table_entry *entry = poll_get_entry(pwq); |
| 221 | if (!entry) | 221 | if (!entry) |
| 222 | return; | 222 | return; |
| 223 | get_file(filp); | 223 | entry->filp = get_file(filp); |
| 224 | entry->filp = filp; | ||
| 225 | entry->wait_address = wait_address; | 224 | entry->wait_address = wait_address; |
| 226 | entry->key = p->_key; | 225 | entry->key = p->_key; |
| 227 | init_waitqueue_func_entry(&entry->wait, pollwake); | 226 | init_waitqueue_func_entry(&entry->wait, pollwake); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index aa110476a95b..de1db1c12080 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -1074,7 +1074,11 @@ struct file_handle { | |||
| 1074 | unsigned char f_handle[0]; | 1074 | unsigned char f_handle[0]; |
| 1075 | }; | 1075 | }; |
| 1076 | 1076 | ||
| 1077 | #define get_file(x) atomic_long_inc(&(x)->f_count) | 1077 | static inline struct file *get_file(struct file *f) |
| 1078 | { | ||
| 1079 | atomic_long_inc(&f->f_count); | ||
| 1080 | return f; | ||
| 1081 | } | ||
| 1078 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) | 1082 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) |
| 1079 | #define file_count(x) atomic_long_read(&(x)->f_count) | 1083 | #define file_count(x) atomic_long_read(&(x)->f_count) |
| 1080 | 1084 | ||
diff --git a/mm/fremap.c b/mm/fremap.c index 9ed4fd432467..048659c0c03d 100644 --- a/mm/fremap.c +++ b/mm/fremap.c | |||
| @@ -195,10 +195,9 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, | |||
| 195 | */ | 195 | */ |
| 196 | if (mapping_cap_account_dirty(mapping)) { | 196 | if (mapping_cap_account_dirty(mapping)) { |
| 197 | unsigned long addr; | 197 | unsigned long addr; |
| 198 | struct file *file = vma->vm_file; | 198 | struct file *file = get_file(vma->vm_file); |
| 199 | 199 | ||
| 200 | flags &= MAP_NONBLOCK; | 200 | flags &= MAP_NONBLOCK; |
| 201 | get_file(file); | ||
| 202 | addr = mmap_region(file, start, size, | 201 | addr = mmap_region(file, start, size, |
| 203 | flags, vma->vm_flags, pgoff); | 202 | flags, vma->vm_flags, pgoff); |
| 204 | fput(file); | 203 | fput(file); |
| @@ -1301,8 +1301,7 @@ munmap_back: | |||
| 1301 | goto free_vma; | 1301 | goto free_vma; |
| 1302 | correct_wcount = 1; | 1302 | correct_wcount = 1; |
| 1303 | } | 1303 | } |
| 1304 | vma->vm_file = file; | 1304 | vma->vm_file = get_file(file); |
| 1305 | get_file(file); | ||
| 1306 | error = file->f_op->mmap(file, vma); | 1305 | error = file->f_op->mmap(file, vma); |
| 1307 | if (error) | 1306 | if (error) |
| 1308 | goto unmap_and_free_vma; | 1307 | goto unmap_and_free_vma; |
diff --git a/mm/nommu.c b/mm/nommu.c index d4b0c10872de..dee2ff89fd58 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
| @@ -1282,10 +1282,8 @@ unsigned long do_mmap_pgoff(struct file *file, | |||
| 1282 | vma->vm_pgoff = pgoff; | 1282 | vma->vm_pgoff = pgoff; |
| 1283 | 1283 | ||
| 1284 | if (file) { | 1284 | if (file) { |
| 1285 | region->vm_file = file; | 1285 | region->vm_file = get_file(file); |
| 1286 | get_file(file); | 1286 | vma->vm_file = get_file(file); |
| 1287 | vma->vm_file = file; | ||
| 1288 | get_file(file); | ||
| 1289 | if (vm_flags & VM_EXECUTABLE) { | 1287 | if (vm_flags & VM_EXECUTABLE) { |
| 1290 | added_exe_file_vma(current->mm); | 1288 | added_exe_file_vma(current->mm); |
| 1291 | vma->vm_mm = current->mm; | 1289 | vma->vm_mm = current->mm; |
diff --git a/net/compat.c b/net/compat.c index 74ed1d7a84a2..79ae88485001 100644 --- a/net/compat.c +++ b/net/compat.c | |||
| @@ -301,8 +301,7 @@ void scm_detach_fds_compat(struct msghdr *kmsg, struct scm_cookie *scm) | |||
| 301 | break; | 301 | break; |
| 302 | } | 302 | } |
| 303 | /* Bump the usage count and install the file. */ | 303 | /* Bump the usage count and install the file. */ |
| 304 | get_file(fp[i]); | 304 | fd_install(new_fd, get_file(fp[i])); |
| 305 | fd_install(new_fd, fp[i]); | ||
| 306 | } | 305 | } |
| 307 | 306 | ||
| 308 | if (i > 0) { | 307 | if (i > 0) { |
diff --git a/net/core/scm.c b/net/core/scm.c index 040cebeed45b..b0098d259233 100644 --- a/net/core/scm.c +++ b/net/core/scm.c | |||
| @@ -281,11 +281,10 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) | |||
| 281 | break; | 281 | break; |
| 282 | } | 282 | } |
| 283 | /* Bump the usage count and install the file. */ | 283 | /* Bump the usage count and install the file. */ |
| 284 | get_file(fp[i]); | ||
| 285 | sock = sock_from_file(fp[i], &err); | 284 | sock = sock_from_file(fp[i], &err); |
| 286 | if (sock) | 285 | if (sock) |
| 287 | sock_update_netprioidx(sock->sk, current); | 286 | sock_update_netprioidx(sock->sk, current); |
| 288 | fd_install(new_fd, fp[i]); | 287 | fd_install(new_fd, get_file(fp[i])); |
| 289 | } | 288 | } |
| 290 | 289 | ||
| 291 | if (i > 0) | 290 | if (i > 0) |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 4dfbcea10eb7..651d8456611a 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
| @@ -2135,8 +2135,7 @@ static inline void flush_unauthorized_files(const struct cred *cred, | |||
| 2135 | if (!IS_ERR(devnull)) { | 2135 | if (!IS_ERR(devnull)) { |
| 2136 | /* replace all the matching ones with this */ | 2136 | /* replace all the matching ones with this */ |
| 2137 | do { | 2137 | do { |
| 2138 | get_file(devnull); | 2138 | replace_fd(n - 1, get_file(devnull), 0); |
| 2139 | replace_fd(n - 1, devnull, 0); | ||
| 2140 | } while ((n = iterate_fd(files, n, match_file, cred)) != 0); | 2139 | } while ((n = iterate_fd(files, n, match_file, cred)) != 0); |
| 2141 | fput(devnull); | 2140 | fput(devnull); |
| 2142 | } else { | 2141 | } else { |
