summaryrefslogtreecommitdiff
path: root/src/util/fossilize_db.c
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>2021-06-19 18:40:49 +0200
committerMarge Bot <eric+marge@anholt.net>2021-06-21 10:05:12 +0000
commitbd41c51c8f4d67d18d8a4407358ea4b71f153d2a (patch)
treebf98a69ecb4a705e8420ecbfe3874410c95c5af1 /src/util/fossilize_db.c
parenta99474fae52db73a23861c2ba961ee5424222da5 (diff)
downloadmesa-bd41c51c8f4d67d18d8a4407358ea4b71f153d2a.tar.gz
util/fossilize_db: Pull seek into lock.
Otherwise the seek can overlap with other reads/writes. Fixes: eca6bb9540d ("util/fossilize_db: add basic fossilize db util to read/write shader caches") Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11485>
Diffstat (limited to 'src/util/fossilize_db.c')
-rw-r--r--src/util/fossilize_db.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util/fossilize_db.c b/src/util/fossilize_db.c
index b77d7bcfa9b..0d26cb00cae 100644
--- a/src/util/fossilize_db.c
+++ b/src/util/fossilize_db.c
@@ -362,14 +362,14 @@ foz_read_entry(struct foz_db *foz_db, const uint8_t *cache_key_160bit,
goto fail;
}
+ /* Reset file offset to the end of the file ready for writing */
+ fseek(foz_db->file[file_idx], offset, SEEK_SET);
+
simple_mtx_unlock(&foz_db->mtx);
if (size)
*size = data_sz;
- /* Reset file offset to the end of the file ready for writing */
- fseek(foz_db->file[file_idx], offset, SEEK_SET);
-
return data;
fail: