Skip to content

Commit 1099e0a

Browse files
authored
SWDEV-526188 - Fix race condition in StatCO::getStatFunc()
Make sure that a newly created FatBinaryInfo is assigned to modules only after extractFatBinary has been called for the object.
1 parent 072fb08 commit 1099e0a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hipamd/src/hip_code_object.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,10 +1312,10 @@ hipError_t StatCO::digestFatBinary(const void* data, FatBinaryInfo*& programs) {
13121312
}
13131313

13141314
// Create a new fat binary object and extract the fat binary for all devices.
1315-
programs = new FatBinaryInfo(nullptr, data);
1316-
IHIP_RETURN_ONFAIL(programs->ExtractFatBinary(g_devices));
1317-
1318-
return hipSuccess;
1315+
FatBinaryInfo* fatBinaryInfo = new FatBinaryInfo(nullptr, data);
1316+
hipError_t err = fatBinaryInfo->ExtractFatBinary(g_devices);
1317+
programs = fatBinaryInfo;
1318+
return err;
13191319
}
13201320

13211321
FatBinaryInfo** StatCO::addFatBinary(const void* data, bool initialized, bool& success) {

0 commit comments

Comments
 (0)