Andrii Nakryiko
09cad07547
fs: fix NULL dereference due to data race in prepend_path()
...
Fix data race in prepend_path() with re-reading mnt->mnt_ns twice
without holding the lock.
is_mounted() does check for NULL, but is_anon_ns(mnt->mnt_ns) might
re-read the pointer again which could be NULL already, if in between
reads one of kern_unmount()/kern_unmount_array()/umount_tree() sets
mnt->mnt_ns to NULL.
This is seen in production with the following stack trace:
BUG: kernel NULL pointer dereference, address: 0000000000000048
...
RIP: 0010:prepend_path.isra.4+0x1ce/0x2e0
Call Trace:
d_path+0xe6/0x150
proc_pid_readlink+0x8f/0x100
vfs_readlink+0xf8/0x110
do_readlinkat+0xfd/0x120
__x64_sys_readlinkat+0x1a/0x20
do_syscall_64+0x42/0x110
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fixes: f2683bd8d5 ("[PATCH] fix d_absolute_path() interplay with fsmount()")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org >
Reviewed-by: Josef Bacik <josef@toxicpanda.com >
Cc: Alexander Viro <viro@zeniv.linux.org.uk >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-10-14 14:54:45 -07:00
..
2020-09-24 13:43:39 -06:00
2020-08-23 17:36:59 -05:00
2020-08-31 12:20:31 +02:00
2020-10-13 12:12:44 -07:00
2020-09-29 17:18:34 -07:00
2020-06-24 09:16:02 -06:00
2020-10-13 12:12:44 -07:00
2020-07-08 08:27:56 +02:00
2020-08-28 10:33:04 -07:00
2020-10-10 15:52:54 -07:00
2020-05-05 09:22:21 -06:00
2020-08-23 17:36:59 -05:00
2020-09-28 14:44:51 -07:00
2020-09-04 18:12:52 +02:00
2020-10-13 08:59:39 -07:00
2020-08-07 11:33:22 -07:00
2020-09-25 23:29:04 +02:00
2020-06-24 09:16:02 -06:00
2020-10-09 10:37:42 +08:00
2020-10-07 14:27:13 +09:00
2020-09-05 10:00:05 -07:00
2020-09-22 06:48:52 -07:00
2020-10-13 08:54:00 -07:00
2020-08-12 10:58:01 -07:00
2020-06-03 16:27:18 -07:00
2020-10-13 12:12:44 -07:00
2020-08-28 10:41:00 -07:00
2020-06-24 09:16:02 -06:00
2020-08-23 17:36:59 -05:00
2020-06-06 10:08:17 -07:00
2020-08-12 10:57:56 -07:00
2020-09-28 08:51:08 -07:00
2020-08-04 13:49:43 -07:00
2020-08-19 12:04:35 -04:00
2020-08-23 17:36:59 -05:00
2020-09-21 08:59:26 -07:00
2020-07-27 23:15:48 +02:00
2020-08-12 10:58:00 -07:00
2020-10-13 12:12:44 -07:00
2020-08-23 17:36:59 -05:00
2020-09-25 08:18:57 -06:00
2020-08-23 17:36:59 -05:00
2020-06-14 01:57:21 +09:00
2020-08-23 17:36:59 -05:00
2020-10-13 18:38:27 -07:00
2020-10-13 18:38:27 -07:00
2020-07-16 12:35:15 -07:00
2020-08-04 15:01:58 -04:00
2020-08-04 13:49:43 -07:00
2020-10-13 18:38:35 -07:00
2020-08-23 17:36:59 -05:00
2020-06-02 10:59:07 -07:00
2020-10-12 16:37:13 -07:00
2020-08-06 19:28:26 -07:00
2020-08-21 09:52:53 -07:00
2020-08-21 09:52:53 -07:00
2020-06-05 14:05:57 -07:00
2020-10-13 12:12:44 -07:00
2020-08-23 17:36:59 -05:00
2020-08-23 17:36:59 -05:00
2020-10-13 12:12:44 -07:00
2020-07-21 16:02:41 -07:00
2020-10-14 14:06:06 -07:00
2020-08-11 17:42:24 +09:00
2020-10-12 16:35:51 -07:00
2020-06-03 23:16:55 -04:00
2020-05-07 16:55:47 -05:00
2020-08-07 13:29:39 -07:00
2020-07-27 14:29:23 -04:00
2020-06-04 19:18:29 -07:00
2020-08-24 08:49:13 +10:00
2020-06-04 19:18:29 -07:00
2020-06-04 19:18:29 -07:00
2020-10-05 10:38:33 -06:00
2020-09-07 10:23:07 -06:00
2020-05-14 16:44:23 +02:00
2020-06-05 13:45:21 -07:00
2020-08-12 10:58:01 -07:00
2020-10-14 14:54:45 -07:00
2020-09-21 08:59:27 -07:00
2020-07-29 16:14:27 +02:00
2020-10-07 12:17:59 +02:00
2020-05-06 22:33:43 -04:00
2020-09-24 19:41:58 -04:00
2020-09-30 20:32:32 -06:00
2020-08-23 17:36:59 -05:00
2020-06-29 09:40:55 -07:00
2020-09-30 20:32:32 -06:00
2020-08-23 17:36:59 -05:00
2020-10-13 18:38:27 -07:00
2020-07-29 16:14:27 +02:00
2020-10-13 12:12:44 -07:00
2020-08-23 17:36:59 -05:00
2020-08-04 21:02:38 -04:00
2020-06-05 16:26:36 -07:00
2020-09-22 23:45:57 -04:00
2020-10-13 12:36:21 -07:00
2020-09-30 20:32:34 -06:00
2020-09-30 20:32:34 -06:00
2020-07-31 08:16:01 +02:00
2020-08-07 11:33:24 -07:00
2020-06-14 01:57:21 +09:00
2020-08-23 17:36:59 -05:00
2020-08-23 17:36:59 -05:00
2020-09-22 23:45:57 -04:00
2020-05-14 16:44:24 +02:00
2020-06-02 10:59:07 -07:00
2020-09-24 13:43:38 -06:00
2020-10-12 16:44:57 -07:00
2020-05-13 11:41:22 +02:00
2020-08-12 10:58:01 -07:00
2020-10-11 11:11:35 -07:00
2020-04-27 10:37:14 -04:00
2020-06-08 11:04:19 -07:00
2020-06-04 13:54:34 -07:00
2020-10-12 16:35:51 -07:00
2020-07-31 08:16:00 +02:00
2020-05-29 19:10:42 -04:00
2020-08-23 17:36:59 -05:00
2020-08-23 17:36:59 -05:00
2020-10-12 16:35:51 -07:00
2020-06-02 19:45:12 -07:00
2020-09-24 13:43:39 -06:00
2020-06-09 15:40:50 -07:00
2020-08-10 19:07:44 -07:00
2020-07-31 08:16:01 +02:00
2020-10-13 18:38:27 -07:00