[PATCH 6.3 267/286] test_firmware: prevent race conditions by a correct implementation of locking