]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.8.5/isofs-do-not-return-eacces-for-unknown-filesystems.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.8.5 / isofs-do-not-return-eacces-for-unknown-filesystems.patch
CommitLineData
4f0a39a2
GKH
1From a2ed0b391dd9c3ef1d64c7c3e370f4a5ffcd324a Mon Sep 17 00:00:00 2001
2From: Jan Kara <jack@suse.cz>
3Date: Tue, 4 Oct 2016 13:44:06 +0200
4Subject: isofs: Do not return EACCES for unknown filesystems
5
6From: Jan Kara <jack@suse.cz>
7
8commit a2ed0b391dd9c3ef1d64c7c3e370f4a5ffcd324a upstream.
9
10When isofs_mount() is called to mount a device read-write, it returns
11EACCES even before it checks that the device actually contains an isofs
12filesystem. This may confuse mount(8) which then tries to mount all
13subsequent filesystem types in read-only mode.
14
15Fix the problem by returning EACCES only once we verify that the device
16indeed contains an iso9660 filesystem.
17
18Fixes: 17b7f7cf58926844e1dd40f5eb5348d481deca6a
19Reported-by: Kent Overstreet <kent.overstreet@gmail.com>
20Reported-by: Karel Zak <kzak@redhat.com>
21Signed-off-by: Jan Kara <jack@suse.cz>
22Signed-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