[PATCH] Fix the fdtable freeing in the case of vmalloced fdset/arrays

Noted by David Miller:

"The bug is that free_fd_array() takes a "num" argument, but when
calling it from __free_fdtable() we're instead passing in the size in
bytes (ie. "num * sizeof(struct file *)")."

Yes it is a bug. I think I messed it up while merging newer
changes with an older version where I was using size in bytes
to optimize.

Signed-off-by: Dipankar Sarma <dipankar@in.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Dipankar Sarma and committed by Linus Torvalds 0b175a7e c7e43c78

+3 -7
+3 -7
fs/file.c
··· 69 69 70 70 static void __free_fdtable(struct fdtable *fdt) 71 71 { 72 - int fdset_size, fdarray_size; 73 - 74 - fdset_size = fdt->max_fdset / 8; 75 - fdarray_size = fdt->max_fds * sizeof(struct file *); 76 - free_fdset(fdt->open_fds, fdset_size); 77 - free_fdset(fdt->close_on_exec, fdset_size); 78 - free_fd_array(fdt->fd, fdarray_size); 72 + free_fdset(fdt->open_fds, fdt->max_fdset); 73 + free_fdset(fdt->close_on_exec, fdt->max_fdset); 74 + free_fd_array(fdt->fd, fdt->max_fds); 79 75 kfree(fdt); 80 76 } 81 77