Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp19383lqz; Fri, 29 Mar 2024 07:20:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8iFnJ2JJ9w3RTdi/n8kvDNxCSbRVzvG+8zT5loykKYeYmkR6vOGYPHwy05EU8YC1arnsVjqmdFM6RrheRJDCz27IZBhj5mBHpmlXEDg== X-Google-Smtp-Source: AGHT+IF9v6mZLmoq15etXG2gY/8Ze1fmL6c61e1ymdoqKKlARqDU+YIhZlYeB2QLW12fwYVueErv X-Received: by 2002:a05:6830:1b79:b0:6e7:5de:d42e with SMTP id d25-20020a0568301b7900b006e705ded42emr2671177ote.29.1711722050020; Fri, 29 Mar 2024 07:20:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711722049; cv=pass; d=google.com; s=arc-20160816; b=SW8xSTY2XRnfX90Z4lR+Mw3gwTy1DCBgnpg1zbfwYaLhDNQ/2yDtgFqV+NqTEnYMUs 2Eq1W9bgqX13SKgZp17VO6sAauD6AQpF8YTVUL/F6H/NnjGsYu6CGB5pou1i+mbFp3K4 POFBp/jr8wgPhNU6M4ZN1HlCo+TG/g11PvJ0h0+0m+myqfmoVR4fyhbO9tU9yPn4e2i7 F3yE23fTGSfO+dD2goruk225/XlEEw8zhcAp1L/GmT31sp9WP62yz+Hpof0IahxBN1VU Q6MWlQWdUU+w9sRtFrPbioLW4FWiWxez+IGIW5F5fEjL+oM0iZd3rgams3DSJUaS43UF x/+g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=De8WjH/vMjraCjkeUvQIRP9DGzf4ooh6upNFart+QrY=; fh=RdY9sXKjIBAK02/imaWqff1vFqxXUYvIlsjBFWIFxCo=; b=kRZTzXuOdWrs0cg2TYFeXNrp0fDHpnX3sjxLCyRdxZq+MYX2uLIcDGtLJSntPr8ZV2 yupMCydYgAaRh46hzIqD6g4FFz8r4IgOEoCgAhPqSuSK7FR1N2Dh3LFVMcuPcgixEf2G as2B/jqAAI3KX3c1rySNt6RheWRcmIE9z/3Bs2pNXn1trn1bzcgtxy0SGk2iiBrmt51S jQIUm2gBpUZ2NuFC7FpwURr3v9bI9ci46omcN35QzJPYKli2CZm+B9JkcqmzRLtRUN0P UOaNmBXUAJnYv+rpQ4SEx/cRxY5AX35+8p2i/PXx6MDe8Wo1mO9laK0LnystwwUMNWtj R4kQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Osijzzs5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124896-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bk21-20020a05620a1a1500b00789faaef7c7si4247228qkb.268.2024.03.29.07.20.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 07:20:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124896-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Osijzzs5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124896-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124896-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BBF911C278EC for ; Fri, 29 Mar 2024 14:20:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 714352365A1; Fri, 29 Mar 2024 12:46:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Osijzzs5" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 977B623658B; Fri, 29 Mar 2024 12:46:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716385; cv=none; b=rs2obixyqsA2LVcuUedZ0n/xgVQS/fc+u3svwta7XbxI+8NXS1+C0K4mhDspwL3pHvuB2v32wMI2W7tmloLXwpbw27QyeIFyXxjn9MzxlsWdnPkG35FYc8GHMIpZeJr6Yv63N8S3IbDQBRDvnf+LQzZmQ8D7GIZsGrm5e5mMYOA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716385; c=relaxed/simple; bh=X+bTYyVLoxeWuZfwjWgmZvLj4dT4ohDe+Hb8ohJxybA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rEhDJmnYAdNgvpSgUz9n1wibI8RaZQIi9k6MC2lqorXmSIIRI3o6VNkLe8gAuKVJ+X/T80QNuUEmmTgJm5x56y5vSfjbS5PCGB0dhZcffTh1xIfHTBVN9ORD1VSpHDZOavSX0JNRTGhDFfGKeQxVX9jIAEZKiHlnEusxSgu0hsY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Osijzzs5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B69AEC433C7; Fri, 29 Mar 2024 12:46:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711716385; bh=X+bTYyVLoxeWuZfwjWgmZvLj4dT4ohDe+Hb8ohJxybA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Osijzzs5K33RClrOuYA3c2CBk74e1UiUKm7DVegypB+VGY5/LAmQtZT/XwzPsslSE XSbSqouqbyK53kC0AL8OZo0QaFMnBIrdUtCUCQpyA6mbx64geFX85Vwhr+Z4MZ0e10 rtTGqkJhdI6ZLTqjNA88Y8G2gk1fCa0L+iqvBlZWc3zBCgfgBMW0dAUnmqKlg5RT1f dDkJS4BiKc32pruXqs76x55LC/rQ2kjv+KQu+h/4e7AeS3FE5V3HclM8M1qC214F3g xIidZZtX7xdjUEizjthceBNd6I4uNOjSxyEv5IhJopBTA4vBd9RSyNOrrfk+v0D8LP itEaFi7L8ELaQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alex Henrie , Jan Kara , Sasha Levin , linux-fsdevel@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 12/52] isofs: handle CDs with bad root inode but good Joliet root directory Date: Fri, 29 Mar 2024 08:45:06 -0400 Message-ID: <20240329124605.3091273-12-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329124605.3091273-1-sashal@kernel.org> References: <20240329124605.3091273-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.83 Content-Transfer-Encoding: 8bit From: Alex Henrie [ 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 Signed-off-by: Jan Kara Message-Id: <20240208022134.451490-1-alexhenrie24@gmail.com> Signed-off-by: Sasha Levin --- fs/isofs/inode.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index df9d70588b600..8a6c7fdc1d5fc 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c @@ -908,8 +908,22 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) * 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 -- 2.43.0