]>
Commit | Line | Data |
---|---|---|
4f0a39a2 GKH |
1 | From a2ed0b391dd9c3ef1d64c7c3e370f4a5ffcd324a Mon Sep 17 00:00:00 2001 |
2 | From: Jan Kara <jack@suse.cz> | |
3 | Date: Tue, 4 Oct 2016 13:44:06 +0200 | |
4 | Subject: isofs: Do not return EACCES for unknown filesystems | |
5 | ||
6 | From: Jan Kara <jack@suse.cz> | |
7 | ||
8 | commit a2ed0b391dd9c3ef1d64c7c3e370f4a5ffcd324a upstream. | |
9 | ||
10 | When isofs_mount() is called to mount a device read-write, it returns | |
11 | EACCES even before it checks that the device actually contains an isofs | |
12 | filesystem. This may confuse mount(8) which then tries to mount all | |
13 | subsequent filesystem types in read-only mode. | |
14 | ||
15 | Fix the problem by returning EACCES only once we verify that the device | |
16 | indeed contains an iso9660 filesystem. | |
17 | ||
18 | Fixes: 17b7f7cf58926844e1dd40f5eb5348d481deca6a | |
19 | Reported-by: Kent Overstreet <kent.overstreet@gmail.com> | |
20 | Reported-by: Karel Zak <kzak@redhat.com> | |
21 | Signed-off-by: Jan Kara <jack@suse.cz> | |
22 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
23 | ||
24 | --- | |
25 | fs/isofs/inode.c | 8 +++++--- | |
26 | 1 file changed, 5 insertions(+), 3 deletions(-) | |
27 | ||
28 | --- a/fs/isofs/inode.c | |
29 | +++ b/fs/isofs/inode.c | |
30 | @@ -687,6 +687,11 @@ static int isofs_fill_super(struct super | |
31 | pri_bh = NULL; | |
32 | ||
33 | root_found: | |
34 | + /* We don't support read-write mounts */ | |
35 | + if (!(s->s_flags & MS_RDONLY)) { | |
36 | + error = -EACCES; | |
37 | + goto out_freebh; | |
38 | + } | |
39 | ||
40 | if (joliet_level && (pri == NULL || !opt.rock)) { | |
41 | /* This is the case of Joliet with the norock mount flag. | |
42 | @@ -1501,9 +1506,6 @@ struct inode *__isofs_iget(struct super_ | |
43 | static struct dentry *isofs_mount(struct file_system_type *fs_type, | |
44 | int flags, const char *dev_name, void *data) | |
45 | { | |
46 | - /* We don't support read-write mounts */ | |
47 | - if (!(flags & MS_RDONLY)) | |
48 | - return ERR_PTR(-EACCES); | |
49 | return mount_bdev(fs_type, flags, dev_name, data, isofs_fill_super); | |
50 | } | |
51 |