From 1cceaba7320e9aeab767ef50d88ab799e11d9b1e Mon Sep 17 00:00:00 2001 From: guomeicen Date: Mon, 28 Jul 2025 15:07:36 +0800 Subject: [PATCH] add parentInode check Signed-off-by: guomeicen --- .../src/cloud_disk/file_operations_cloud.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp b/services/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp index 374dc8a0c..a7ebe2086 100644 --- a/services/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp +++ b/services/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp @@ -96,6 +96,10 @@ static void InitInodeAttr(struct CloudDiskFuseData *data, fuse_ino_t parent, HITRACE_METER_NAME(HITRACE_TAG_FILEMANAGEMENT, __PRETTY_FUNCTION__); auto parentInode = FileOperationsHelper::FindCloudDiskInode(data, static_cast(parent)); + if (parentInode == nullptr) { + LOGE("parent inode not found"); + return; + } childInode->stat = parentInode->stat; childInode->stat.st_ino = static_cast(inodeId); childInode->stat.st_mtime = metaBase.mtime / MILLISECOND_TO_SECONDS_TIMES; @@ -1961,6 +1965,11 @@ void FileOperationsCloud::SetAttr(fuse_req_t req, fuse_ino_t ino, struct stat *a } auto parentInode = FileOperationsHelper::FindCloudDiskInode(data, static_cast(inoPtr->parent)); + if (parentInode == nullptr) { + LOGE("parent inode not found"); + fuse_reply_err(req, EINVAL); + return; + } if (static_cast(valid) & FUSE_SET_ATTR_SIZE) { DatabaseManager &databaseManager = DatabaseManager::GetInstance(); auto rdbStore = databaseManager.GetRdbStore(inoPtr->bundleName, data->userId); -- Gitee