History

Merge tag 'locking-urgent-2020-11-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull futex fix from Thomas Gleixner: "A single fix for the futex code where an intermediate state in the underlying RT mutex was not handled correctly and triggering a BUG() instead of treating it as another variant of retry condition" * tag 'locking-urgent-2020-11-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: futex: Handle transient "ownerless" rtmutex state correctly

Linus Torvalds committed 6 years ago

Commit aaaaa7e2 parents 15a9844 9f5d1c31 file · +14 −2Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/futex.c+14−2
@@ -2380,10 +2380,22 @@ retry: · 2379 unmodified lines
23802380 }
23812381
23822382 /*
2383− * Since we just failed the trylock; there must be an owner.
2383+ * The trylock just failed, so either there is an owner or
2384+ * there is a higher priority waiter than this one.
23842385 */
23852386 newowner = rt_mutex_owner(&pi_state->pi_mutex);
2386− BUG_ON(!newowner);
2387+ /*
2388+ * If the higher priority waiter has not yet taken over the
2389+ * rtmutex then newowner is NULL. We can't return here with
2390+ * that state because it's inconsistent vs. the user space
2391+ * state. So drop the locks and try again. It's a valid
2392+ * situation and not any different from the other retry
2393+ * conditions.
2394+ */
2395+ if (unlikely(!newowner)) {
2396+ err = -EAGAIN;
2397+ goto handle_err;
2398+ }
23872399 } else {
23882400 WARN_ON_ONCE(argowner != current);
23892401 if (oldowner == current) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t