David Sterba
81ffd56b57
btrfs: fix mount and ioctl device scan ioctl race
...
Technically this extends the critical section covered by uuid_mutex to:
- parse early mount options -- here we can call device scan on paths
that can be passed as 'device=/dev/...'
- scan the device passed to mount
- open the devices related to the fs_devices -- this increases
fs_devices::opened
The race can happen when mount calls one of the scans and there's
another one called eg. by mkfs or 'btrfs dev scan':
Mount Scan
----- ----
scan_one_device (dev1, fsid1)
scan_one_device (dev2, fsid1)
add the device
free stale devices
fsid1 fs_devices::opened == 0
find fsid1:dev1
free fsid1:dev1
if it's the last one,
free fs_devices of fsid1
too
open_devices (dev1, fsid1)
dev1 not found
When fixed, the uuid mutex will make sure that mount will increase
fs_devices::opened and this will not be touched by the racing scan
ioctl.
Reported-and-tested-by: syzbot+909a5177749d7990ffa4@syzkaller.appspotmail.com
Reported-and-tested-by: syzbot+ceb2606025ec1cc3479c@syzkaller.appspotmail.com
Reviewed-by: Anand Jain <anand.jain@oracle.com >
Signed-off-by: David Sterba <dsterba@suse.com >
2018-08-06 13:12:48 +02:00
..
2018-06-12 16:19:22 -07:00
2018-06-15 07:31:07 +09:00
2018-05-28 12:36:41 +02:00
2018-06-16 16:32:04 +09:00
2018-07-14 11:11:09 -07:00
2018-06-15 18:10:01 -03:00
2018-05-22 14:27:50 -04:00
2018-08-06 13:12:48 +02:00
2018-07-25 14:49:00 +01:00
2018-06-26 18:42:44 +02:00
2018-07-05 13:48:25 -05:00
2018-06-05 16:57:31 -07:00
2018-06-05 16:57:31 -07:00
2018-06-15 07:31:07 +09:00
2018-06-11 10:16:13 -07:00
2018-06-12 20:52:16 -07:00
2018-03-14 13:31:23 +01:00
2018-06-12 16:19:22 -07:00
2018-05-26 09:16:25 +02:00
2018-02-22 10:21:02 -08:00
2018-06-15 07:55:24 +09:00
2018-04-12 12:04:49 +02:00
2018-06-20 11:04:26 +02:00
2018-07-29 15:34:00 -04:00
2018-06-15 07:31:07 +09:00
2018-07-21 12:50:46 -07:00
2018-05-22 14:27:51 -04:00
2018-07-25 14:49:00 +01:00
2018-06-15 07:31:07 +09:00
2018-06-15 07:31:07 +09:00
2018-06-15 07:31:07 +09:00
2018-06-15 07:31:07 +09:00
2018-06-05 16:57:31 -07:00
2018-06-12 16:19:22 -07:00
2018-07-26 19:38:03 -07:00
2018-04-16 09:47:41 +02:00
2018-07-08 11:10:30 -07:00
2018-06-15 07:31:07 +09:00
2018-08-04 07:53:46 -07:00
2018-06-15 07:31:07 +09:00
2018-03-27 13:18:09 -04:00
2018-05-22 14:27:52 -04:00
2018-08-01 23:17:06 -04:00
2018-03-27 13:18:09 -04:00
2018-06-15 07:31:07 +09:00
2018-05-11 15:36:37 -04:00
2018-05-18 14:58:22 +02:00
2018-06-15 07:31:07 +09:00
2018-06-15 07:31:07 +09:00
2018-05-22 14:27:58 -04:00
2018-05-22 14:27:57 -04:00
2018-06-17 05:25:18 +09:00
2018-06-15 07:31:07 +09:00
2018-07-14 11:11:09 -07:00
2018-06-14 14:57:24 +02:00
2018-05-22 14:27:52 -04:00
2018-05-22 14:27:54 -04:00
2018-06-20 11:04:26 +02:00
2018-07-14 11:11:10 -07:00
2018-05-22 14:27:55 -04:00
2018-08-02 09:34:02 -07:00
2018-05-21 14:30:09 -04:00
2018-05-22 14:27:53 -04:00
2018-06-15 07:31:07 +09:00
2018-06-20 11:05:49 +02:00
2018-06-12 16:19:22 -07:00
2018-07-24 11:34:52 -07:00
2018-07-22 12:04:51 -07:00
2018-06-15 07:31:07 +09:00
2018-06-05 16:57:31 -07:00
2018-04-11 10:28:37 -07:00
2018-06-12 16:19:22 -07:00
2018-07-14 11:11:10 -07:00
2018-04-11 10:28:37 -07:00
2018-06-15 18:11:26 -03:00
2018-07-27 12:51:00 -07:00
2018-06-01 18:37:33 -07:00
2018-03-15 17:59:24 +01:00
2018-06-07 17:34:40 -07:00
2018-06-05 19:23:26 +02:00
2018-03-29 15:07:46 -04:00
2018-06-08 17:21:52 -07:00
2018-06-04 10:14:28 -07:00
2018-04-02 20:15:39 +02:00
2018-05-14 08:55:18 -06:00
2018-06-28 10:40:47 -07:00
2018-06-28 10:40:47 -07:00
2018-07-26 19:38:03 -07:00
2018-06-07 17:34:35 -07:00
2018-04-02 20:16:00 +02:00
2018-05-16 07:23:35 +02:00
2018-05-03 16:11:37 -06:00
2018-07-05 12:36:36 -07:00
2018-07-10 23:29:03 -04:00
2018-05-24 12:04:28 -05:00
2018-08-02 13:09:27 -07:00
2018-06-11 08:22:34 -07:00
2018-06-15 18:11:26 -03:00
2018-03-30 11:34:55 -07:00
2018-06-15 07:31:07 +09:00
2018-06-11 08:22:34 -07:00
2018-06-12 16:19:22 -07:00
2018-06-16 16:32:04 +09:00
2018-05-24 12:02:25 -05:00
2018-02-15 15:34:42 -05:00
2018-06-03 10:58:23 -07:00
2018-06-28 10:40:47 -07:00
2018-02-11 14:34:03 -08:00
2018-06-12 16:19:22 -07:00
2018-04-02 20:16:02 +02:00
2018-06-28 10:40:47 -07:00
2018-05-25 18:12:11 -07:00
2018-06-16 16:21:50 +09:00
2018-06-16 16:21:50 +09:00
2018-04-02 20:15:34 +02:00
2018-06-04 10:14:28 -07:00
2018-04-04 12:44:02 -07:00
2018-06-28 10:40:47 -07:00
2018-08-02 16:03:40 -07:00
2018-04-02 20:15:44 +02:00
2018-05-29 13:22:41 -04:00