In the do_mkdir function in tee_supplicant/src/tee_supp_fs.c:
if (stat(path, &st) != 0 && !S_ISDIR(st.st_mode))
return -1;
Should that have || (OR), not && (AND) ?
If stat somehow fails to fill the st, then the st could contain uninitialized data and the ISDIR check with it is not reasonable.