Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp1074605lqh; Fri, 29 Mar 2024 06:37:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXvrNG3KbODlNrCH3X0KfHNEDO+DvGswISl4CVKbNHToGxEohaTYxK2Mv4li1fmOlznu6avdc6+ffFPJoZs4j+hGPmitOB29g4i5IbXuw== X-Google-Smtp-Source: AGHT+IFcajmSkI0nGPFjPUo6LfJKi4m4PrAlbcmNMsVoKmqS7QRpcyYIIo1q3wFSuUQ3Fv9bRqKE X-Received: by 2002:a05:6808:2783:b0:3c3:e0bf:ceb6 with SMTP id es3-20020a056808278300b003c3e0bfceb6mr1881773oib.17.1711719457436; Fri, 29 Mar 2024 06:37:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711719457; cv=pass; d=google.com; s=arc-20160816; b=xC5sHf7nSSmEVbATDhAiVKHRJ6Jg7wlQt26/Sdyixe2b/kc7aUpgdkRkqruzW5ZYDm ugbI2HMknxmS0MF4gPsNw3VbbBK/sb3Z8/j6DZ8IwxlryvfOF1AKJv08JStjRXrcljvf mTSZEU3u61pNnO8hZeZnitKvQS7wEJ5jfeAe+CZMZ2WUuhaSlNgy1F7cLDcto8139qD6 Io09rWo/AmpGbWUTPxgpUDD9oD+tHKtFTK+JTcAXCMvGhUYxtXaLrgUYy+I5/UbnOA6i Jrzx3VxtdJMmZqn2+Ds1P2URgd8vkqbH0slQhgjOpjhBwx4UemNWBn878PQHCHC9boo9 7dVg== 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=HS/xpCAwGPLxjxkkMFrvasJSTDt3o2F2widJzEWD0nQ=; fh=RdY9sXKjIBAK02/imaWqff1vFqxXUYvIlsjBFWIFxCo=; b=KBpGpjUGfzT5ym7seqhx7nRAo1YbhqDcDgv6HvX+WpUSC+7WyMqH5aXUz+mHrEZsgc 5Ttie4XAmMRf4J/aBI8vctmO3YWIWLbrKrnihrObXWY6iwnxAN0Cmus0Z2yTGImNf29V hmf/qyW4zMXFKJmrBnDDmf2OuxJWA036/bl9ioxm0WeaX5IHr8zQIv4bhtsh8fPuyCsy E4EKoPwlPRm+bVvXAolgD8chHQCwUrutgB9AuUy+UPHLi7cC0YudtnV5rDvM0uFq7FKS U2OF7XuccrTy5mq4/s3vJ/RVtseEbpQcpd5AX0Wr42Gfjxr/bnh/SISucOu7u0xooIKe 5w9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cAMiVAmZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124734-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124734-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n3-20020a0cfbc3000000b00696147f22a9si3584675qvp.415.2024.03.29.06.37.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 06:37:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124734-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cAMiVAmZ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124734-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124734-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 24B551C2235F for ; Fri, 29 Mar 2024 13:37:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E907E178CD7; Fri, 29 Mar 2024 12:40:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cAMiVAmZ" 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 06021146D7B; Fri, 29 Mar 2024 12:40:42 +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=1711716043; cv=none; b=U5looWXBDOuviVybgb4mp7wbgC7jQm8/2ewdpQMVFAk2t5abK+dwjeogtXXUpLSWJavBXBGoC39pLLBDan087qtStQsAhytpq1ZWQ6gDI8dN03lODjg6W4P0Kar8WUkoopR3mVHU5FUQSrJM6Gs9tTEx4LCAmDYBjEBceqvZJP4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711716043; c=relaxed/simple; bh=dI+n5cg8esWd0k+bureAZYabQ7kxSKrIKWns4EovvvQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OUhjD0WcGFzjInylrWAdT5CjParVB7yj0bmVPAlZfLyoSSUa+NlU2eVFH2xnhsHvxzRTrRNwHRPIhUW7MKPrNGIpZlC9V2hIEvx7c1PTmbTszbsXQrqR2u+hp8AR8GlqYZJ2FCsQlC2PbLRndxB9riIR/9aia/ZiKANzRKNQjFY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cAMiVAmZ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4859C43394; Fri, 29 Mar 2024 12:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711716042; bh=dI+n5cg8esWd0k+bureAZYabQ7kxSKrIKWns4EovvvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cAMiVAmZLBVJasiB9va0DUzgAuSX3fyzPte8gK9wMm1t0cr/V3raQ78dVF2eKfQG7 YwVrJLIES6EKra+vu1YpOmimnyY1ztfXksChHLp0DCrTxCKqUZjrielXGuVlgy/MwD y4irppGkuOtAGb+t7XZ4GPsIbDhlAVY37iVo8fxeHJl8lbJCLOqVokvoixemwUlcT4 tMhd1ef9tpPFXNN0UMOEs7Yfzqi6xNf15WBJqsj78DYYjq32cw13OEnkLAXwDUIhWW wo0UUetMEl7bVWdoIyY6DHMnn+QpCJobsM7fOiwF4pYbZo0tyASfzvifc0SMcKqb58 Q8O75Zz9y4jOw== 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.8 25/98] isofs: handle CDs with bad root inode but good Joliet root directory Date: Fri, 29 Mar 2024 08:36:56 -0400 Message-ID: <20240329123919.3087149-25-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329123919.3087149-1-sashal@kernel.org> References: <20240329123919.3087149-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.8.2 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 3e4d53e26f947..379c9edc907cf 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