Skip to content

Commit f075faa

Browse files
Davidlohr Buesotorvalds
authored andcommitted
ipc/sem.c: prevent queue.status tearing in semop
In order for load/store tearing prevention to work, _all_ accesses to the variable in question need to be done around READ and WRITE_ONCE() macros. Ensure everyone does so for q->status variable for semtimedop(). Link: http://lkml.kernel.org/r/20180717052654.676-1-dave@stgolabs.net Signed-off-by: Davidlohr Bueso <dbueso@suse.de> Cc: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 15d36fe commit f075faa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ipc/sem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2118,7 +2118,7 @@ static long do_semtimedop(int semid, struct sembuf __user *tsops,
21182118
}
21192119

21202120
do {
2121-
queue.status = -EINTR;
2121+
WRITE_ONCE(queue.status, -EINTR);
21222122
queue.sleeper = current;
21232123

21242124
__set_current_state(TASK_INTERRUPTIBLE);

0 commit comments

Comments
 (0)