fs: fix close_on_exec pointer in alloc_fdtable
PATCH 1/1 fs: fix close_on_exec pointer in alloc_fdtable
alloc_fdtable allocates space for the open_fds and close_on_exec bitfields together, as 2 * nr / BITS_PER_BYTE. close_on_exec needs to point to open_fds + nr / BITS_PER_BYTE, not open_fds + nr / BITS_PER_LONG, as introducted in 1fd36adc: Replace the fd_sets in struct fdtable with an array of unsigned longs.
--- fs/file.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/file.c +1 -1
@@ -179,7 +179,7 @@ static struct fdtable * alloc_fdtable(unsigned int nr)if (!data) goto out_arr; fdt->open_fds = data; - data += nr /BITS_PER_LONG ; + data += nr /BITS_PER_BYTE ; fdt->close_on_exec = data; fdt->next =NULL ;
Signature · 1 line
1.7.7.6
Quoted 7 lines · Bobby Powers
alloc_fdtableallocates space for theopen_fdsandclose_on_execbitfields together, as 2 * nr /BITS_PER_BYTE.close_on_execneeds to point toopen_fds+ nr /BITS_PER_BYTE, notopen_fds+ nr /BITS_PER_LONG, as introducted in1fd36adc: Replace thefd_setsin struct fdtable with an array of unsigned longs.Signed-off-by Bobby Powers <[email protected]>
Yes, you're right. At one point I changed data to be an unsigned long *.
Quoted 8 lines · David Howells
Quoted 6 lines · Bobby Powers
alloc_fdtableallocates space for theopen_fdsandclose_on_execbitfields together, as 2 * nr /BITS_PER_BYTE. close_on_exec needs to point toopen_fds+ nr /BITS_PER_BYTE, notopen_fds+ nr /BITS_PER_LONG, as introducted in1fd36adc: Replace thefd_setsin struct fdtable with an array of unsigned longs.
Quoted 5 lines
Quoted 1 line
Signed-off-by Bobby Powers <[email protected]>Yes, you're right. At one point I changed data to be an unsigned long *.
Acked-by David Howells <[email protected]>
Thanks, its nice to have confirmation - I'm still pretty new at this. Can this get pulled onto tip/x86/x32? Desktop applications like firefox and chrome don't work reliably without it.
Quoted 11 lines · Bobby Powers
Quoted 10 lines · David Howells
Quoted 7 lines · Bobby Powers
alloc_fdtableallocates space for theopen_fdsandclose_on_execbitfields together, as 2 * nr /BITS_PER_BYTE.close_on_execneeds to point toopen_fds+ nr /BITS_PER_BYTE, notopen_fds+ nr /BITS_PER_LONG, as introducted in1fd36adc: Replace thefd_setsin struct fdtable with an array of unsigned longs.Signed-off-by Bobby Powers<[email protected]>
Quoted 8 lines
Quoted 3 lines
Yes, you're right. At one point I changed data to be an unsigned long *.
Acked-by David Howells<[email protected]>Thanks, its nice to have confirmation - I'm still pretty new at this. Can this get pulled onto tip/x86/x32? Desktop applications like firefox and chrome don't work reliably without it.
tip:core/types (and the updated core/types needs to be merged into x86/x32) but yes.
-hpa
[tip:core/types] fs: Fix close_on_exec pointer in alloc_fdtable
In reply to Bobby PowersCommit-ID: f044db4cb4bf16893812d35b5fbeaaf3e30c9215 Gitweb: http://git.kernel.org/tip/f044db4cb4bf16893812d35b5fbeaaf3e30c9215 Author: Bobby Powers <[email protected]> AuthorDate: Wed, 22 Feb 2012 00:29:47 -0500 Committer: H. Peter Anvin <[email protected]> CommitDate: Thu, 23 Feb 2012 18:28:52 -0800
fs: Fix close_on_exec pointer in alloc_fdtable
alloc_fdtable allocates space for the open_fds and close_on_exec bitfields together, as 2 * nr / BITS_PER_BYTE. close_on_exec needs to point to open_fds + nr / BITS_PER_BYTE, not open_fds + nr / BITS_PER_LONG, as introducted in 1fd36adc: Replace the fd_sets in struct fdtable with an array of unsigned longs.
--- fs/file.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/file.c +1 -1
@@ -179,7 +179,7 @@ static struct fdtable * alloc_fdtable(unsigned int nr)if (!data) goto out_arr; fdt->open_fds = data; - data += nr /BITS_PER_LONG ; + data += nr /BITS_PER_BYTE ; fdt->close_on_exec = data; fdt->next =NULL ;