Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fold security_file_free() into file_free()

.. and the call of file_free() in case of security_file_alloc() failure
in get_empty_filp() should be simply file_free_rcu() - no point in
rcu-delays there, anyway.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro e8cff84f c7e9075f

+4 -6
+4 -6
fs/file_table.c
··· 51 51 52 52 static inline void file_free(struct file *f) 53 53 { 54 + security_file_free(f); 54 55 percpu_counter_dec(&nr_files); 55 56 call_rcu(&f->f_u.fu_rcuhead, file_free_rcu); 56 57 } ··· 124 123 if (unlikely(!f)) 125 124 return ERR_PTR(-ENOMEM); 126 125 127 - percpu_counter_inc(&nr_files); 128 126 f->f_cred = get_cred(cred); 129 127 error = security_file_alloc(f); 130 128 if (unlikely(error)) { 131 - file_free(f); 129 + file_free_rcu(&f->f_u.fu_rcuhead); 132 130 return ERR_PTR(error); 133 131 } 134 132 ··· 137 137 mutex_init(&f->f_pos_lock); 138 138 eventpoll_init_file(f); 139 139 /* f->f_version: 0 */ 140 + percpu_counter_inc(&nr_files); 140 141 return f; 141 142 142 143 over: ··· 208 207 } 209 208 if (file->f_op->release) 210 209 file->f_op->release(inode, file); 211 - security_file_free(file); 212 210 if (unlikely(S_ISCHR(inode->i_mode) && inode->i_cdev != NULL && 213 211 !(file->f_mode & FMODE_PATH))) { 214 212 cdev_put(inode->i_cdev); ··· 302 302 303 303 void put_filp(struct file *file) 304 304 { 305 - if (atomic_long_dec_and_test(&file->f_count)) { 306 - security_file_free(file); 305 + if (atomic_long_dec_and_test(&file->f_count)) 307 306 file_free(file); 308 - } 309 307 } 310 308 311 309 void __init files_init(void)