]> git.hungrycats.org Git - linux/commit
fs/9p: fix uninitialized values during inode evict
authorEric Van Hensbergen <ericvh@kernel.org>
Tue, 19 Mar 2024 13:50:32 +0000 (13:50 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 May 2024 10:14:37 +0000 (12:14 +0200)
commit1b4cb6e91f19b81217ad98142ee53a1ab25893fd
treedaea3f1b74cfb6c81faabec20dbecce2e1eceaea
parent658d316e339efaa79a75bee5e5547af086b3e9b3
fs/9p: fix uninitialized values during inode evict

[ Upstream commit 6630036b7c228f57c7893ee0403e92c2db2cd21d ]

If an iget fails due to not being able to retrieve information
from the server then the inode structure is only partially
initialized.  When the inode gets evicted, references to
uninitialized structures (like fscache cookies) were being
made.

This patch checks for a bad_inode before doing anything other
than clearing the inode from the cache.  Since the inode is
bad, it shouldn't have any state associated with it that needs
to be written back (and there really isn't a way to complete
those anyways).

Reported-by: syzbot+eb83fe1cce5833cd66a0@syzkaller.appspotmail.com
Signed-off-by: Eric Van Hensbergen <ericvh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/9p/vfs_inode.c