diff options
author | Oleg Nesterov <oleg@redhat.com> | 2017-10-03 16:15:45 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-10-03 17:54:25 -0700 |
commit | baba1b29731c79d605100087b8f02f9e1cf5a344 (patch) | |
tree | 23f11135fccb4464ce80d3f18ed162d7c667e420 /crypto/internal.h | |
parent | c2315c187fa0d3ab363fdebe22718170b40473e3 (diff) | |
download | linux-baba1b29731c79d605100087b8f02f9e1cf5a344.tar.gz linux-baba1b29731c79d605100087b8f02f9e1cf5a344.tar.bz2 linux-baba1b29731c79d605100087b8f02f9e1cf5a344.zip |
exec: binfmt_misc: don't nullify Node->dentry in kill_node()
kill_node() nullifies/checks Node->dentry to avoid double free. This
complicates the next changes and this is very confusing:
- we do not need to check dentry != NULL under entries_lock,
kill_node() is always called under inode_lock(d_inode(root)) and we
rely on this inode_lock() anyway, without this lock the
MISC_FMT_OPEN_FILE cleanup could race with itself.
- if kill_inode() was already called and ->dentry == NULL we should not
even try to close e->interp_file.
We can change bm_entry_write() to simply check !list_empty(list) before
kill_node. Again, we rely on inode_lock(), in particular it saves us
from the race with bm_status_write(), another caller of kill_node().
Link: http://lkml.kernel.org/r/20170922143641.GA17210@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Kees Cook <keescook@chromium.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Ben Woodard <woodard@redhat.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jim Foraker <foraker1@llnl.gov>
Cc: <tdhooge@llnl.gov>
Cc: Travis Gummels <tgummels@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'crypto/internal.h')
0 files changed, 0 insertions, 0 deletions