diff --git a/bsd-user/freebsd/os-thread.c b/bsd-user/freebsd/os-thread.c index e298073181..5d7f5ea3bc 100644 --- bsd-user/freebsd/os-thread.c +++ bsd-user/freebsd/os-thread.c @@ -1262,6 +1262,7 @@ abi_long freebsd_rw_unlock(abi_ulong target_addr) /* decrement reader count */ for (;;) { if (!tcmpset_32(&target_urwlock->rw_state, state, (state - 1))) { + __get_user(state, &target_urwlock->rw_state); if (TARGET_URWLOCK_READER_COUNT(state) == 0) { unlock_user_struct(target_urwlock, target_addr, 1);