From mboxrd@z Thu Jan 1 00:00:00 1970 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 09C98314D2F; Fri, 21 Nov 2025 13:46:51 +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=1763732811; cv=none; b=X8bO66lU2HYiwhWpVMrOGezLeXyvHqiPufuqqhVlJ6afuoW6nGl37dmWWnX7vrYA3sJWJ/sfWNs+ZwA4xCatVnkneTNYLbjh9/4BUgfN1LQd/KGTCWn6Yv9zHWSnqvE3yCyTWFTkSFjEGcJeg/UqDpMKgmmqeqf05qOuFdkaXEc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763732811; c=relaxed/simple; bh=i1NEEaxdICPNkVJXmR2EjEDwBmzXxU+pq4QCx2QR4xg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lhK6jS/IXJ59ukk+5QnLDken4kCmur4fmBPutx/2otex37zUlmdTfNMxc1+BLFbogRCZWUAO31o6osmRPb2Oo7IravD/9k0FikXEFkjKSuI86oBAk5fd+XR0GRVMhWChlX+oo6n0I+EWcjj2TnzYELir7GyXlyWOi7/guYQCq78= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nIGAEAAQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nIGAEAAQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 817C6C4CEF1; Fri, 21 Nov 2025 13:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1763732810; bh=i1NEEaxdICPNkVJXmR2EjEDwBmzXxU+pq4QCx2QR4xg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nIGAEAAQPy80owupLESxKP4VpXpHBcDHHeLow3guJCQH1NZhVO+ToGw8EyTUL7iHk ua5UVDP1gpS7Bvf22BokrD1KHSe3xA8pu4xl3tONioM3dygQr8L6hq1aGCQIp+6cJ1 bX4seqzbHrpBatfk5XSK2UcmjKpRixpGHBT2xXH4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot , Tetsuo Handa , Dave Kleikamp , Sasha Levin Subject: [PATCH 6.6 252/529] jfs: Verify inode mode when loading from disk Date: Fri, 21 Nov 2025 14:09:11 +0100 Message-ID: <20251121130239.986144396@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251121130230.985163914@linuxfoundation.org> References: <20251121130230.985163914@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tetsuo Handa [ Upstream commit 7a5aa54fba2bd591b22b9b624e6baa9037276986 ] 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=895c23f6917da440ed0d Signed-off-by: Tetsuo Handa Signed-off-by: Dave Kleikamp Signed-off-by: Sasha Levin --- 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 66c38ef5e5711..1e6c1d1a15a6a 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] = '\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 = &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; -- 2.51.0