summaryrefslogtreecommitdiff
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
authorPrateek Sood <prsood@codeaurora.org>2017-05-25 17:17:26 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2017-07-02 21:22:04 -0700
commitba6bd90a30896933174c26e2d96d4df9acfcb75c (patch)
treec28265da03560ab58a38b6e7eb7e20100e70a3ce /net/unix/af_unix.c
parentc1a5075d60955f6e4a15ce94aebd746c27684466 (diff)
osq_lock: fix osq_lock queue corruption
Fix ordering of link creation between node->prev and prev->next in osq_lock(). A case in which the status of optimistic spin queue is CPU6->CPU2 in which CPU6 has acquired the lock. At this point if CPU0 comes in to acquire osq_lock, it will update the tail count. After tail count update if CPU2 starts to unqueue itself from optimistic spin queue, it will find updated tail count with CPU0 and update CPU2 node->next to NULL in osq_wait_next(). If reordering of following stores happen then prev->next where prev being CPU2 would be updated to point to CPU0 node: node->prev = prev; WRITE_ONCE(prev->next, node); At this point if next instruction WRITE_ONCE(next->prev, prev); in CPU2 path is committed before the update of CPU0 node->prev = prev then CPU0 node->prev will point to CPU6 node. At this point if CPU0 path's node->prev = prev is committed resulting in change of CPU0 prev back to CPU2 node. CPU2 node->next is NULL currently, so if CPU0 gets into unqueue path of osq_lock it will keep spinning in infinite loop as condition prev->next == node will never be true. Change-Id: I48d847096daf3c228de90ae1cd2a6415b7bde65a Signed-off-by: Prateek Sood <prsood@codeaurora.org>
Diffstat (limited to 'net/unix/af_unix.c')
0 files changed, 0 insertions, 0 deletions