summaryrefslogtreecommitdiffstats
path: root/kernel/locking/rwsem-spinlock.c
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2017-03-28 02:03:35 +0200
committerJames Morris <james.l.morris@oracle.com>2017-03-28 02:03:35 +0200
commit840c91dc6a13b160f5b6e5c79c430dffac11c945 (patch)
tree5309824f4531b2611a575e7971a935d2e95feb02 /kernel/locking/rwsem-spinlock.c
parentLSM: Initialize security_hook_heads upon registration. (diff)
parentLinux 4.11-rc4 (diff)
downloadlinux-840c91dc6a13b160f5b6e5c79c430dffac11c945.tar.xz
linux-840c91dc6a13b160f5b6e5c79c430dffac11c945.zip
update to v4.11-rc4 due to memory corruption bug in rc2
Diffstat (limited to 'kernel/locking/rwsem-spinlock.c')
-rw-r--r--kernel/locking/rwsem-spinlock.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/kernel/locking/rwsem-spinlock.c b/kernel/locking/rwsem-spinlock.c
index 7bc24d477805..c65f7989f850 100644
--- a/kernel/locking/rwsem-spinlock.c
+++ b/kernel/locking/rwsem-spinlock.c
@@ -213,10 +213,9 @@ int __sched __down_write_common(struct rw_semaphore *sem, int state)
*/
if (sem->count == 0)
break;
- if (signal_pending_state(state, current)) {
- ret = -EINTR;
- goto out;
- }
+ if (signal_pending_state(state, current))
+ goto out_nolock;
+
set_current_state(state);
raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
schedule();
@@ -224,12 +223,19 @@ int __sched __down_write_common(struct rw_semaphore *sem, int state)
}
/* got the lock */
sem->count = -1;
-out:
list_del(&waiter.list);
raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
return ret;
+
+out_nolock:
+ list_del(&waiter.list);
+ if (!list_empty(&sem->wait_list))
+ __rwsem_do_wake(sem, 1);
+ raw_spin_unlock_irqrestore(&sem->wait_lock, flags);
+
+ return -EINTR;
}
void __sched __down_write(struct rw_semaphore *sem)