Linus Torvalds
d888c83fce
fs: fix fd table size alignment properly
...
Jason Donenfeld reports that my commit 1c24a186398f ("fs: fd tables have
to be multiples of BITS_PER_LONG") doesn't work, and the reason is an
embarrassing brown-paper-bag bug.
Yes, we want to align the number of fds to BITS_PER_LONG, and yes, the
reason they might not be aligned is because the incoming 'max_fd'
argument might not be aligned.
But aligining the argument - while simple - will cause a "infinitely
big" maxfd (eg NR_OPEN_MAX) to just overflow to zero. Which most
definitely isn't what we want either.
The obvious fix was always just to do the alignment last, but I had
moved it earlier just to make the patch smaller and the code look
simpler. Duh. It certainly made _me_ look simple.
Fixes: 1c24a186398f ("fs: fd tables have to be multiples of BITS_PER_LONG")
Reported-and-tested-by: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Fedor Pchelkin <aissur0002@gmail.com>
Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Christian Brauner <brauner@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-03-29 23:29:18 -07:00
..
2022-03-22 18:26:56 -07:00
2022-03-22 18:26:56 -07:00
2022-03-22 18:26:56 -07:00
2022-03-22 18:26:56 -07:00
2021-10-20 21:09:02 -04:00
2022-03-22 15:57:03 -07:00
2022-03-22 18:26:56 -07:00
2022-03-26 11:51:46 -07:00
2022-03-26 11:51:46 -07:00
2022-03-24 18:32:48 -07:00
2022-03-24 11:39:32 -07:00
2022-03-22 17:03:12 -07:00
2022-02-22 18:30:28 +01:00
2021-10-18 14:43:22 -06:00
2022-03-22 09:50:16 -07:00
2022-02-25 11:56:13 +01:00
2022-01-24 14:17:02 +01:00
2022-01-12 11:11:34 -08:00
2022-03-22 18:26:56 -07:00
2022-03-22 15:57:03 -07:00
2022-03-22 18:26:56 -07:00
2022-03-22 18:26:56 -07:00
2022-03-25 17:38:15 -07:00
2022-03-26 11:51:46 -07:00
2022-03-26 11:51:46 -07:00
2022-03-24 14:14:07 -07:00
2022-03-22 15:57:03 -07:00
2022-03-15 08:34:36 -04:00
2022-03-27 10:17:23 -07:00
2022-03-26 11:51:46 -07:00
2022-03-22 18:26:56 -07:00
2022-03-22 18:26:56 -07:00
2022-03-22 18:26:56 -07:00
2022-03-22 18:26:56 -07:00
2022-03-22 18:26:56 -07:00
2022-03-26 12:41:52 -07:00
2022-03-22 15:57:03 -07:00
2022-03-22 18:26:56 -07:00
2022-03-22 15:57:03 -07:00
2022-03-29 18:17:30 -07:00
2022-03-18 13:38:03 +01:00
2022-03-24 11:39:32 -07:00
2022-02-28 10:26:40 -05:00
2022-03-24 14:14:07 -07:00
2022-01-21 21:36:28 +00:00
2022-03-29 18:55:37 -07:00
2021-10-04 22:02:17 +01:00
2022-03-22 17:03:12 -07:00
2022-03-22 18:26:56 -07:00
2022-03-14 09:05:25 +01:00
2022-03-22 18:26:56 -07:00
2022-03-22 18:26:56 -07:00
2022-03-22 18:26:56 -07:00
2022-03-16 13:37:04 -04:00
2022-03-22 15:57:03 -07:00
2022-03-22 18:26:56 -07:00
2022-03-22 15:57:03 -07:00
2022-03-28 17:29:53 -07:00
2022-03-15 11:08:23 -07:00
2022-03-22 15:57:03 -07:00
2022-03-22 15:57:03 -07:00
2022-01-30 08:59:47 -08:00
2021-11-09 10:11:53 -08:00
2022-03-25 17:38:15 -07:00
2022-03-22 15:57:03 -07:00
2022-01-18 16:50:47 -06:00
2022-03-22 16:11:53 -07:00
2022-02-23 15:46:34 +01:00
2022-03-22 18:26:56 -07:00
2022-02-25 21:05:04 -05:00
2022-03-28 12:41:28 -07:00
2022-03-25 17:38:15 -07:00
2022-03-22 18:26:56 -07:00
2022-02-01 11:13:24 -08:00
2022-03-22 18:26:56 -07:00
2021-09-22 10:56:34 -07:00
2022-03-27 10:17:23 -07:00
2022-03-26 11:51:46 -07:00
2022-03-26 11:51:46 -07:00
2021-09-19 22:35:37 -04:00
2021-11-17 09:26:09 +01:00
2021-08-18 22:08:24 +02:00
2021-09-05 10:15:05 -07:00
2022-03-08 12:55:29 -06:00
2022-03-03 20:38:56 -08:00
2022-03-21 19:16:02 -07:00
2022-03-09 10:37:07 -06:00
2022-02-09 09:50:02 -08:00
2022-03-26 11:51:46 -07:00
2022-03-03 20:38:56 -08:00
2022-03-28 17:29:53 -07:00
2021-11-06 13:30:32 -07:00
2022-03-24 18:12:09 -07:00
2022-03-22 15:57:03 -07:00
2022-03-07 12:45:57 -07:00
2021-09-03 09:58:10 -07:00
2021-09-06 07:20:56 -04:00
2022-01-22 08:33:35 +02:00
2022-03-28 17:29:53 -07:00
2022-03-08 17:55:03 -07:00
2022-02-17 10:23:19 -08:00
2022-03-29 23:29:18 -07:00
2021-08-23 01:25:40 -04:00
2022-01-18 09:23:19 +02:00
2021-12-09 14:09:36 -05:00
2022-03-22 16:11:53 -07:00
2022-03-22 15:57:03 -07:00
2022-03-22 10:51:40 -07:00
2022-03-28 17:29:53 -07:00
2022-03-28 17:29:53 -07:00
2022-01-17 05:49:30 +02:00
2022-03-14 13:13:53 +01:00
2022-03-22 17:03:12 -07:00
2022-03-21 19:16:02 -07:00
2021-10-18 20:22:03 -10:00
2022-03-16 13:37:05 -04:00
2022-01-22 08:33:36 +02:00
2022-02-01 11:13:24 -08:00
2022-03-26 11:59:30 -07:00
2022-01-28 17:51:31 +02:00
2022-03-24 10:06:43 -07:00
2022-03-08 17:55:03 -07:00
2022-03-23 19:00:34 -07:00
2021-12-05 10:28:57 +01:00
2021-12-03 18:44:06 +01:00
2022-03-14 13:13:50 +01:00
2022-03-22 18:26:56 -07:00
2022-01-11 09:03:05 -08:00
2021-11-09 10:02:52 -08:00
2022-01-17 05:49:30 +02:00
2022-03-21 12:59:01 -04:00
2022-03-10 09:33:55 -07:00
2022-01-30 08:59:47 -08:00
2022-01-30 08:59:47 -08:00
2022-01-22 08:33:36 +02:00
2021-08-10 17:57:22 +02:00
2022-03-22 15:57:08 -07:00