summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/file.c3
-rw-r--r--fs/file_table.c9
2 files changed, 4 insertions, 8 deletions
diff --git a/fs/file.c b/fs/file.c
index 4eb026631673..1a475d7d636e 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -604,6 +604,9 @@ void fd_install(unsigned int fd, struct file *file)
struct files_struct *files = current->files;
struct fdtable *fdt;
+ if (WARN_ON_ONCE(unlikely(file->f_mode & FMODE_BACKING)))
+ return;
+
rcu_read_lock_sched();
if (unlikely(files->resize_in_progress)) {
diff --git a/fs/file_table.c b/fs/file_table.c
index a79a80031343..08fd1dd6d863 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -61,13 +61,6 @@ struct path *backing_file_real_path(struct file *f)
}
EXPORT_SYMBOL_GPL(backing_file_real_path);
-static void file_free_rcu(struct rcu_head *head)
-{
- struct file *f = container_of(head, struct file, f_rcuhead);
-
- kfree(backing_file(f));
-}
-
static inline void file_free(struct file *f)
{
security_file_free(f);
@@ -76,7 +69,7 @@ static inline void file_free(struct file *f)
put_cred(f->f_cred);
if (unlikely(f->f_mode & FMODE_BACKING)) {
path_put(backing_file_real_path(f));
- call_rcu(&f->f_rcuhead, file_free_rcu);
+ kfree(backing_file(f));
} else {
kmem_cache_free(filp_cachep, f);
}