Skip to content

Commit 124b554

Browse files
committed
Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking fixes from Ingo Molnar: "Three fixes: - Fix an rwsem spin-on-owner crash, introduced in v5.4 - Fix a lockdep bug when running out of stack_trace entries, introduced in v5.4 - Docbook fix" * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: locking/rwsem: Fix kernel crash when spinning on RWSEM_OWNER_UNKNOWN futex: Fix kernel-doc notation warning locking/lockdep: Fix buffer overrun problem in stack_trace[]
2 parents a1c6f87 + 39e7234 commit 124b554

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

kernel/futex.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,7 @@ static int attach_to_pi_state(u32 __user *uaddr, u32 uval,
11781178

11791179
/**
11801180
* wait_for_owner_exiting - Block until the owner has exited
1181+
* @ret: owner's current futex lock status
11811182
* @exiting: Pointer to the exiting task
11821183
*
11831184
* Caller must hold a refcount on @exiting.

kernel/locking/lockdep.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,18 +482,16 @@ static struct lock_trace *save_trace(void)
482482
struct lock_trace *trace, *t2;
483483
struct hlist_head *hash_head;
484484
u32 hash;
485-
unsigned int max_entries;
485+
int max_entries;
486486

487487
BUILD_BUG_ON_NOT_POWER_OF_2(STACK_TRACE_HASH_SIZE);
488488
BUILD_BUG_ON(LOCK_TRACE_SIZE_IN_LONGS >= MAX_STACK_TRACE_ENTRIES);
489489

490490
trace = (struct lock_trace *)(stack_trace + nr_stack_trace_entries);
491491
max_entries = MAX_STACK_TRACE_ENTRIES - nr_stack_trace_entries -
492492
LOCK_TRACE_SIZE_IN_LONGS;
493-
trace->nr_entries = stack_trace_save(trace->entries, max_entries, 3);
494493

495-
if (nr_stack_trace_entries >= MAX_STACK_TRACE_ENTRIES -
496-
LOCK_TRACE_SIZE_IN_LONGS - 1) {
494+
if (max_entries <= 0) {
497495
if (!debug_locks_off_graph_unlock())
498496
return NULL;
499497

@@ -502,6 +500,7 @@ static struct lock_trace *save_trace(void)
502500

503501
return NULL;
504502
}
503+
trace->nr_entries = stack_trace_save(trace->entries, max_entries, 3);
505504

506505
hash = jhash(trace->entries, trace->nr_entries *
507506
sizeof(trace->entries[0]), 0);

kernel/locking/rwsem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,8 +1226,8 @@ rwsem_down_write_slowpath(struct rw_semaphore *sem, int state)
12261226
* In this case, we attempt to acquire the lock again
12271227
* without sleeping.
12281228
*/
1229-
if ((wstate == WRITER_HANDOFF) &&
1230-
(rwsem_spin_on_owner(sem, 0) == OWNER_NULL))
1229+
if (wstate == WRITER_HANDOFF &&
1230+
rwsem_spin_on_owner(sem, RWSEM_NONSPINNABLE) == OWNER_NULL)
12311231
goto trylock_again;
12321232

12331233
/* Block until there are no active lockers. */

0 commit comments

Comments
 (0)