exec: binfmt_misc: remove the confusing e->interp_file != NULL checks
authorOleg Nesterov <[email protected]>
Tue, 3 Oct 2017 23:15:51 +0000 (16:15 -0700)
committerLinus Torvalds <[email protected]>
Wed, 4 Oct 2017 00:54:25 +0000 (17:54 -0700)
If MISC_FMT_OPEN_FILE flag is set e->interp_file must be valid or we
have a bug which should not be silently ignored.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Oleg Nesterov <[email protected]>
Acked-by: Kees Cook <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Ben Woodard <[email protected]>
Cc: James Bottomley <[email protected]>
Cc: Jim Foraker <[email protected]>
Cc: <[email protected]>
Cc: Travis Gummels <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/binfmt_misc.c

index 203598ccb40adecf5b70f6ade2f31be06054a6a6..babfe7bd56f066b0d699dd22520a1b74ef3f6125 100644 (file)
@@ -205,7 +205,7 @@ static int load_misc_binary(struct linux_binprm *bprm)
        if (retval < 0)
                goto error;
 
-       if (fmt->flags & MISC_FMT_OPEN_FILE && fmt->interp_file) {
+       if (fmt->flags & MISC_FMT_OPEN_FILE) {
                interp_file = filp_clone_open(fmt->interp_file);
                if (!IS_ERR(interp_file))
                        deny_write_access(interp_file);
@@ -596,7 +596,7 @@ static void bm_evict_inode(struct inode *inode)
 {
        Node *e = inode->i_private;
 
-       if ((e->flags & MISC_FMT_OPEN_FILE) && e->interp_file)
+       if (e->flags & MISC_FMT_OPEN_FILE)
                filp_close(e->interp_file, NULL);
 
        clear_inode(inode);