summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Henrie <alexhenrie24@gmail.com>2024-02-07 19:21:32 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-13 12:51:38 +0200
commit2c1f840469e1ffb736c6d667fc1e292ff10dc780 (patch)
tree1a3128ce2c8beba3e805064a9f3c305431d8beb4
parente2cd32435b1dff3d63759476a3abc878e02fb6c8 (diff)
downloadlinux-stable-2c1f840469e1ffb736c6d667fc1e292ff10dc780.tar.gz
linux-stable-2c1f840469e1ffb736c6d667fc1e292ff10dc780.tar.bz2
linux-stable-2c1f840469e1ffb736c6d667fc1e292ff10dc780.zip
isofs: handle CDs with bad root inode but good Joliet root directory
[ Upstream commit 4243bf80c79211a8ca2795401add9c4a3b1d37ca ] I have a CD copy of the original Tom Clancy's Ghost Recon game from 2001. The disc mounts without error on Windows, but on Linux mounting fails with the message "isofs_fill_super: get root inode failed". The error originates in isofs_read_inode, which returns -EIO because de_len is 0. The superblock on this disc appears to be intentionally corrupt as a form of copy protection. When the root inode is unusable, instead of giving up immediately, try to continue with the Joliet file table. This fixes the Ghost Recon CD and probably other copy-protected CDs too. Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz> Message-Id: <20240208022134.451490-1-alexhenrie24@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/isofs/inode.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 74e487d63c62..95c08f3c4b35 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -912,8 +912,22 @@ root_found:
* we then decide whether to use the Joliet descriptor.
*/
inode = isofs_iget(s, sbi->s_firstdatazone, 0);
- if (IS_ERR(inode))
- goto out_no_root;
+
+ /*
+ * Fix for broken CDs with a corrupt root inode but a correct Joliet
+ * root directory.
+ */
+ if (IS_ERR(inode)) {
+ if (joliet_level && sbi->s_firstdatazone != first_data_zone) {
+ printk(KERN_NOTICE
+ "ISOFS: root inode is unusable. "
+ "Disabling Rock Ridge and switching to Joliet.");
+ sbi->s_rock = 0;
+ inode = NULL;
+ } else {
+ goto out_no_root;
+ }
+ }
/*
* Fix for broken CDs with Rock Ridge and empty ISO root directory but