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 EC29B337118; Fri, 17 Oct 2025 15:14:02 +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=1760714043; cv=none; b=u9jYijFYRSyd9x7u1t3f0sgC+/aesUHSA307km3RLilt8LVLkkQ1neEFcXovKzt0FaybWCws7Uge4KlUUtgD0kBadk0OAyySzCwsHpllB+JMY8+yaHNPQLnpnliKE32Y92cy7qgQsA189+WcQLfcKzDzk4ForlF9D4D3yG7rcxE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760714043; c=relaxed/simple; bh=f7oaQo76WgpZqUSYWr1UQsE7xqc/JxuQgxVvCbEVnIQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NDU+7VKaVyrCNKmr1HOFh4Bq4BF7Fc63heodncYj404uShbBBoeeq9MnVUMbmgUxn4+6Osch/lFTPhd6sUnmpVUf/93r/ddlyeQLDeKrPOw929HU6/xdDDv2uk5/zVl2X/uPv6NYD2/uQ27wIyCBFCWAUwwnUC9y9fBX7kEuH/g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Wn3m5McH; 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="Wn3m5McH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76B8BC4CEE7; Fri, 17 Oct 2025 15:14:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1760714042; bh=f7oaQo76WgpZqUSYWr1UQsE7xqc/JxuQgxVvCbEVnIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wn3m5McHTx1MZ6cq+NiTnL2oFMpRgJFeLkIqLl4cMQ+4Nm4gg7i1bCbUaCcEFkVju oNLEPDjVENtYoTPH/NZTEXN01rkEAnDn4xq9RWKLrZrgBo2pRPLhiXnOAsUvQVY7vB XOgiQG6k5qGlyahpBJjUVmcX3rAx/w9mg0ApXdNA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot , Tetsuo Handa , Christian Brauner , Sasha Levin Subject: [PATCH 6.6 194/201] minixfs: Verify inode mode when loading from disk Date: Fri, 17 Oct 2025 16:54:15 +0200 Message-ID: <20251017145141.887729117@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251017145134.710337454@linuxfoundation.org> References: <20251017145134.710337454@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev 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 73861970938ad1323eb02bbbc87f6fbd1e5bacca ] 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 Link: https://lore.kernel.org/ec982681-84b8-4624-94fa-8af15b77cbd2@I-love.SAKURA.ne.jp Signed-off-by: Christian Brauner Signed-off-by: Sasha Levin --- fs/minix/inode.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/minix/inode.c b/fs/minix/inode.c index df575473c1cc0..ee8a6fe360e72 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c @@ -470,8 +470,14 @@ void minix_set_inode(struct inode *inode, dev_t rdev) inode->i_op = &minix_symlink_inode_operations; inode_nohighmem(inode); inode->i_mapping->a_ops = &minix_aops; - } else + } else if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) || + S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) { init_special_inode(inode, inode->i_mode, rdev); + } else { + printk(KERN_DEBUG "MINIX-fs: Invalid file type 0%04o for inode %lu.\n", + inode->i_mode, inode->i_ino); + make_bad_inode(inode); + } } /* -- 2.51.0