]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fput-task_work_add-can-fail-if-the-caller-has-passed-exit_task_work-fix
authorAndrew Morton <akpm@linux-foundation.org>
Wed, 19 Jun 2013 00:05:20 +0000 (10:05 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 19 Jun 2013 07:12:38 +0000 (17:12 +1000)
add comment

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>
fs/file_table.c

index 485dc0eddd6707839120324ab552d94ef5ed5ab9..3a2bbc5b2cf5e99835eef6d78348f44ad921551f 100644 (file)
@@ -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);