summaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-06-14 21:09:47 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2013-06-15 03:39:08 +0200
commite7b2c4069252732d52f1de6d1f7c82d99a156659 (patch)
tree61058c0dd3806eaf067d1e6cf1634aa1acc9336e /kernel/exit.c
parentncpfs: fix rmdir returns Device or resource busy (diff)
downloadlinux-e7b2c4069252732d52f1de6d1f7c82d99a156659.tar.xz
linux-e7b2c4069252732d52f1de6d1f7c82d99a156659.zip
fput: task_work_add() can fail if the caller has passed exit_task_work()
fput() assumes that it can't be called after exit_task_work() but this is not true, for example free_ipc_ns()->shm_destroy() can do this. In this case fput() silently leaks the file. Change it to fallback to delayed_fput_work if task_work_add() fails. The patch looks complicated but it is not, it changes the code from if (PF_KTHREAD) { schedule_work(...); return; } task_work_add(...) to if (!PF_KTHREAD) { if (!task_work_add(...)) return; /* fallback */ } schedule_work(...); As for shm_destroy() in particular, we could make another fix but I think this change makes sense anyway. There could be another similar user, it is not safe to assume that task_work_add() can't fail. Reported-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions