mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
fuse: zero initialize inode private data
[ Upstream commit 3ca1b311181072415b6432a169de765ac2034e5a ] This is slightly tricky, since the VFS uses non-zeroing allocation to preserve some fields that are left in a consistent state. Reported-by: Chunsheng Luo <luochunsheng@ustc.edu> Closes: https://lore.kernel.org/all/20250818083224.229-1-luochunsheng@ustc.edu/ Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
bb9b505f02
commit
a7953bf985
@@ -94,14 +94,11 @@ static struct inode *fuse_alloc_inode(struct super_block *sb)
|
||||
if (!fi)
|
||||
return NULL;
|
||||
|
||||
fi->i_time = 0;
|
||||
/* Initialize private data (i.e. everything except fi->inode) */
|
||||
BUILD_BUG_ON(offsetof(struct fuse_inode, inode) != 0);
|
||||
memset((void *) fi + sizeof(fi->inode), 0, sizeof(*fi) - sizeof(fi->inode));
|
||||
|
||||
fi->inval_mask = ~0;
|
||||
fi->nodeid = 0;
|
||||
fi->nlookup = 0;
|
||||
fi->attr_version = 0;
|
||||
fi->orig_ino = 0;
|
||||
fi->state = 0;
|
||||
fi->submount_lookup = NULL;
|
||||
mutex_init(&fi->mutex);
|
||||
spin_lock_init(&fi->lock);
|
||||
fi->forget = fuse_alloc_forget();
|
||||
|
||||
Reference in New Issue
Block a user