From: Andrew Morton Date: Mon, 8 Jul 2013 21:24:15 +0000 (-0700) Subject: fs/file_table.c:fput(): add comment X-Git-Tag: upstream/snapshot3+hdmi~4691^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=64372501e2af9b11e2ffd1ff79345dc4b1abe539;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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" Cc: Al Viro Cc: Andrey Vagin Cc: David Howells Cc: Oleg Nesterov Signed-off-by: Andrew Morton Signed-off-by: Al Viro --- diff --git a/fs/file_table.c b/fs/file_table.c index 08e719b..b9a77ad 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);