Eric W. Biederman
077130c0cf
[NET]: Fix race when opening a proc file while a network namespace is exiting.
...
The problem: proc_net files remember which network namespace the are
against but do not remember hold a reference count (as that would pin
the network namespace). So we currently have a small window where
the reference count on a network namespace may be incremented when opening
a /proc file when it has already gone to zero.
To fix this introduce maybe_get_net and get_proc_net.
maybe_get_net increments the network namespace reference count only if it is
greater then zero, ensuring we don't increment a reference count after it
has gone to zero.
get_proc_net handles all of the magic to go from a proc inode to the network
namespace instance and call maybe_get_net on it.
PROC_NET the old accessor is removed so that we don't get confused and use
the wrong helper function.
Then I fix up the callers to use get_proc_net and handle the case case
where get_proc_net returns NULL. In that case I return -ENXIO because
effectively the network namespace has already gone away so the files
we are trying to access don't exist anymore.
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Paul E. McKenney <paulmck@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-10 16:49:22 -07:00
..
2007-08-23 10:13:45 -05:00
2007-07-20 10:11:58 +09:00
2007-07-20 10:11:58 +09:00
2007-10-10 16:49:10 -07:00
2007-05-11 08:29:36 -07:00
2007-08-22 19:52:46 -07:00
2007-07-20 10:11:58 +09:00
2007-07-20 10:11:58 +09:00
2007-08-18 00:15:20 +00:00
2007-07-21 17:49:14 -07:00
2007-07-20 10:11:58 +09:00
2007-05-07 12:12:51 -07:00
2007-07-18 15:49:48 -07:00
2007-05-08 11:14:59 -07:00
2007-08-14 10:31:02 +01:00
2007-10-10 16:49:09 -07:00
2007-07-20 10:11:58 +09:00
2007-07-17 10:23:06 -07:00
2007-07-26 11:35:17 -07:00
2007-09-19 11:24:18 -07:00
2007-09-19 11:24:18 -07:00
2007-07-20 10:11:58 +09:00
2007-07-20 10:11:58 +09:00
2007-07-20 10:11:58 +09:00
2007-08-14 10:34:40 +01:00
2007-07-20 10:11:58 +09:00
2007-07-20 10:11:58 +09:00
2007-07-10 08:04:13 +02:00
2007-07-20 10:11:58 +09:00
2007-02-12 09:48:47 -08:00
2007-08-31 01:42:23 -07:00
2007-07-31 15:39:41 -07:00
2007-07-20 10:11:58 +09:00
2007-07-20 10:11:58 +09:00
2007-09-02 18:18:38 +01:00
2007-07-20 10:11:58 +09:00
2007-10-09 12:38:26 -07:00
2007-07-20 10:11:58 +09:00
2007-02-12 09:48:46 -08:00
2007-07-31 15:39:41 -07:00
2007-09-28 15:36:42 -07:00
2006-10-20 10:26:41 -07:00
2007-09-10 18:57:47 -07:00
2007-07-16 09:05:52 -07:00
2007-07-20 10:11:58 +09:00
2007-10-03 11:14:45 -07:00
2007-07-20 10:11:58 +09:00
2007-07-30 00:27:31 -07:00
2007-10-10 16:49:22 -07:00
2007-07-20 10:11:58 +09:00
2007-07-31 15:39:36 -07:00
2007-09-11 17:21:19 -07:00
2007-07-20 10:11:58 +09:00
2007-07-20 10:11:58 +09:00
2007-08-22 14:35:36 -07:00
2007-07-20 10:11:58 +09:00
2007-08-31 01:42:22 -07:00
2007-09-25 08:51:04 -07:00
2007-02-12 09:48:46 -08:00
2007-10-01 07:59:03 -07:00
2007-10-08 12:58:14 -07:00
2007-07-17 11:50:26 -07:00
2007-07-17 12:00:03 -07:00
2007-07-10 08:04:15 +02:00
2006-12-08 08:28:41 -08:00
2007-07-19 10:04:47 -07:00
2007-07-21 17:49:14 -07:00
2007-05-08 11:15:07 -07:00
2007-10-03 23:43:57 +08:00
2007-07-19 10:04:45 -07:00
2007-07-19 10:04:45 -07:00
2006-10-04 06:51:26 -06:00
2007-07-24 09:28:11 +02:00
2007-07-20 10:11:58 +09:00
2007-07-20 08:44:19 -07:00
2007-07-19 10:04:43 -07:00
2007-10-10 16:49:03 -07:00
2007-07-19 10:04:45 -07:00
2007-07-20 10:11:58 +09:00
2007-07-29 17:09:29 -07:00
2007-08-20 22:50:25 -07:00
2007-07-20 10:11:58 +09:00
2007-07-20 10:11:58 +09:00
2007-07-16 09:05:36 -07:00
2007-05-18 13:09:34 -07:00
2007-07-20 10:11:58 +09:00
2007-09-20 13:19:59 -07:00
2007-07-20 10:11:58 +09:00
2007-05-21 09:18:19 -07:00
2007-05-08 11:15:07 -07:00
2006-12-22 08:55:50 -08:00
2007-05-08 11:15:01 -07:00
2007-01-26 12:53:20 -08:00
2007-07-17 12:00:03 -07:00
2007-07-20 10:11:58 +09:00
2007-07-20 10:11:58 +09:00
2007-05-08 11:15:11 -07:00
2007-05-08 11:15:09 -07:00
2007-07-16 09:05:48 -07:00
2007-02-12 09:48:32 -08:00
2007-09-11 11:38:25 -07:00
2007-05-21 14:34:00 +09:00
2007-05-09 06:44:57 +02:00
2007-09-11 17:21:27 -07:00
2007-05-11 08:29:36 -07:00
2007-07-20 10:11:58 +09:00
2007-05-11 08:29:35 -07:00
2007-07-19 10:04:45 -07:00
2007-07-20 10:11:58 +09:00
2007-07-19 10:04:45 -07:00
2006-09-30 20:52:31 +02:00
2007-07-31 15:39:42 -07:00
2007-07-27 08:08:51 +02:00
2007-05-08 11:15:11 -07:00
2006-12-08 08:28:51 -08:00
2006-10-01 00:39:19 -07:00
2007-07-27 15:40:13 -07:00
2007-07-10 08:04:15 +02:00
2006-10-01 00:39:28 -07:00
2007-05-08 11:15:09 -07:00
2007-09-11 17:21:20 -07:00
2007-07-16 09:05:45 -07:00
2007-09-20 13:19:59 -07:00
2007-10-01 13:17:28 -07:00
2007-02-19 14:21:50 -08:00
2007-05-08 11:15:07 -07:00
2007-07-16 09:05:46 -07:00
2007-06-28 11:38:30 -07:00
2007-07-26 11:35:17 -07:00
2007-07-17 12:00:03 -07:00
2007-02-14 08:09:54 -08:00
2007-07-17 12:00:03 -07:00