From nobody Sun Oct 5 03:41:58 2025 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) (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 61B0310F2 for ; Sun, 10 Aug 2025 15:45:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.181.97.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754840756; cv=none; b=N2m9sLu2t+XJe31feBVIFldAubNDcCB/OuADI6CADlykxoNej1JZCSzpdN0pO8HNKpqc0Np71NAsWk7MXJdTLK33CJmXIzsEoa5qobLaeU60WVmdTknNB/QOzM3o17GSNw1UQ7dNGeH01T1A0Dz4XvFp9FNb9ABkUADElltGBEM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754840756; c=relaxed/simple; bh=zrVbR8WZE1YbNvXcLbo4P/kH6LShfC48H7sLm/jnZfg=; h=Message-ID:Date:MIME-Version:To:Cc:From:Subject:Content-Type; b=h0UUDml/OhfMPqybc+gSbao7ANuTF7d6zzlS15if4BDJQ+rg/nH5Uzl2hV7GjaFIOo6l6yYHdiANthA0igGx22Gj3DE1sLk7UP/kdzSlxWU+6Ii+RY66oT143Rx7h1GgOtZxadc1T+lGsGV7dDK7uksFJRcsmn1dP9Sm4iK0iPA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp; arc=none smtp.client-ip=202.181.97.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=I-love.SAKURA.ne.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=I-love.SAKURA.ne.jp Received: from www262.sakura.ne.jp (localhost [127.0.0.1]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 57AEt6f4098946; Sun, 10 Aug 2025 23:55:06 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from [192.168.1.10] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 57AEt614098942 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Sun, 10 Aug 2025 23:55:06 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: <1cd51309-096d-497f-8c5e-b0c9cca102fc@I-love.SAKURA.ne.jp> Date: Sun, 10 Aug 2025 23:55:04 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Dave Kleikamp , jfs-discussion@lists.sourceforge.net Cc: LKML From: Tetsuo Handa Subject: [PATCH] jfs: Verify inode mode when loading from disk Content-Transfer-Encoding: quoted-printable X-Anti-Virus-Server: fsav205.rs.sakura.ne.jp X-Virus-Status: clean Content-Type: text/plain; charset="utf-8" The inode mode loaded from corrupted disk can be invalid. Do like what commit 0a9e74051313 ("isofs: Verify inode mode when loading from disk") does. Reported-by: syzbot Closes: https://syzkaller.appspot.com/bug?extid=3D895c23f6917da440ed0d Signed-off-by: Tetsuo Handa --- fs/jfs/inode.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index fcedeb514e14..21f3d029da7d 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c @@ -59,9 +59,15 @@ struct inode *jfs_iget(struct super_block *sb, unsigned = long ino) */ inode->i_link[inode->i_size] =3D '\0'; } - } else { + } else if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) || + S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) { inode->i_op =3D &jfs_file_inode_operations; init_special_inode(inode, inode->i_mode, inode->i_rdev); + } else { + printk(KERN_DEBUG "JFS: Invalid file type 0%04o for inode %lu.\n", + inode->i_mode, inode->i_ino); + iget_failed(inode); + return ERR_PTR(-EIO); } unlock_new_inode(inode); return inode; --=20 2.50.1