diff --git a/services/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp b/services/cloudfiledaemon/src/cloud_disk/file_operations_cloud.cpp index 374dc8a0c4ce9d958e558c7860f0036fdda6863d..a7ebe2086a8da113bae51b267e30477c2b41690a 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);