[PATCH 1/5] fdtable: Delete pointless code in dup_fd().

From: Vadim Lobanov
Date: Fri Oct 06 2006 - 00:50:57 EST


The dup_fd() function creates a new files_struct and fdtable embedded inside
that files_struct, and then possibly expands the fdtable using expand_files().
The out_release error path is invoked when expand_files() returns an error
code. However, when this attempt to expand fails, the fdtable is left in its
original embedded form, so it is pointless to try to free the associated
fdarray and fdsets.

Signed-off-by: Vadim Lobanov <vlobanov@xxxxxxxxxxxxx>

diff -Npru old/kernel/fork.c new/kernel/fork.c
--- old/kernel/fork.c 2006-10-05 19:18:06.000000000 -0700
+++ new/kernel/fork.c 2006-10-05 19:19:56.000000000 -0700
@@ -727,14 +727,11 @@ static struct files_struct *dup_fd(struc
memset(&new_fdt->close_on_exec->fds_bits[start], 0, left);
}

-out:
return newf;

out_release:
- free_fdset (new_fdt->close_on_exec, new_fdt->max_fdset);
- free_fdset (new_fdt->open_fds, new_fdt->max_fdset);
- free_fd_array(new_fdt->fd, new_fdt->max_fds);
kmem_cache_free(files_cachep, newf);
+out:
return NULL;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/