]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.15/isofs-handle-cds-with-bad-root-inode-but-good-joliet.patch
Fixes for 5.15
[thirdparty/kernel/stable-queue.git] / queue-5.15 / isofs-handle-cds-with-bad-root-inode-but-good-joliet.patch
1 From efb7cd944b099288927aa5746875956effe16154 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Wed, 7 Feb 2024 19:21:32 -0700
4 Subject: isofs: handle CDs with bad root inode but good Joliet root directory
5
6 From: Alex Henrie <alexhenrie24@gmail.com>
7
8 [ Upstream commit 4243bf80c79211a8ca2795401add9c4a3b1d37ca ]
9
10 I have a CD copy of the original Tom Clancy's Ghost Recon game from
11 2001. The disc mounts without error on Windows, but on Linux mounting
12 fails with the message "isofs_fill_super: get root inode failed". The
13 error originates in isofs_read_inode, which returns -EIO because de_len
14 is 0. The superblock on this disc appears to be intentionally corrupt as
15 a form of copy protection.
16
17 When the root inode is unusable, instead of giving up immediately, try
18 to continue with the Joliet file table. This fixes the Ghost Recon CD
19 and probably other copy-protected CDs too.
20
21 Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
22 Signed-off-by: Jan Kara <jack@suse.cz>
23 Message-Id: <20240208022134.451490-1-alexhenrie24@gmail.com>
24 Signed-off-by: Sasha Levin <sashal@kernel.org>
25 ---
26 fs/isofs/inode.c | 18 ++++++++++++++++--
27 1 file changed, 16 insertions(+), 2 deletions(-)
28
29 diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
30 index 0c6eacfcbeef1..07252d2a7f5f2 100644
31 --- a/fs/isofs/inode.c
32 +++ b/fs/isofs/inode.c
33 @@ -908,8 +908,22 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent)
34 * we then decide whether to use the Joliet descriptor.
35 */
36 inode = isofs_iget(s, sbi->s_firstdatazone, 0);
37 - if (IS_ERR(inode))
38 - goto out_no_root;
39 +
40 + /*
41 + * Fix for broken CDs with a corrupt root inode but a correct Joliet
42 + * root directory.
43 + */
44 + if (IS_ERR(inode)) {
45 + if (joliet_level && sbi->s_firstdatazone != first_data_zone) {
46 + printk(KERN_NOTICE
47 + "ISOFS: root inode is unusable. "
48 + "Disabling Rock Ridge and switching to Joliet.");
49 + sbi->s_rock = 0;
50 + inode = NULL;
51 + } else {
52 + goto out_no_root;
53 + }
54 + }
55
56 /*
57 * Fix for broken CDs with Rock Ridge and empty ISO root directory but
58 --
59 2.43.0
60