summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2013-07-03 10:18:44 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2013-07-12 13:01:10 +1000
commit53d9c6487dc36547d845fb8cebdb7c39343e7318 (patch)
treedd688e2c6980976010fad75ab45969649ece23d7 /fs
parentf580929dbfe23ad0c7a8d0e064d088ecb58e334e (diff)
fs/file_table.c:fput(): add comment
A missed update to "fput: task_work_add() can fail if the caller has passed exit_task_work()". Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Andrey Vagin <avagin@openvz.org> Cc: David Howells <dhowells@redhat.com> Cc: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/file_table.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/file_table.c b/fs/file_table.c
index 08e719b884ca..b9a77ad08b4d 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -313,6 +313,12 @@ void fput(struct file *file)
init_task_work(&file->f_u.fu_rcuhead, ____fput);
if (!task_work_add(task, &file->f_u.fu_rcuhead, true))
return;
+ /*
+ * After this task has run exit_task_work(),
+ * task_work_add() will fail. free_ipc_ns()->
+ * shm_destroy() can do this. Fall through to delayed
+ * fput to avoid leaking *file.
+ */
}
spin_lock_irqsave(&delayed_fput_lock, flags);
list_add(&file->f_u.fu_list, &delayed_fput_list);