Skip to content

Commit 8130b9d

Browse files
Dongli Zhangbostrovs
authored andcommitted
xenbus: req->err should be updated before req->state
This patch adds the barrier to guarantee that req->err is always updated before req->state. Otherwise, read_reply() would not return ERR_PTR(req->err) but req->body, when process_writes()->xb_write() is failed. Signed-off-by: Dongli Zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Julien Grall <[email protected]> Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent 1b6a51e commit 8130b9d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/xen/xenbus/xenbus_comms.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@ static int process_writes(void)
397397
if (state.req->state == xb_req_state_aborted)
398398
kfree(state.req);
399399
else {
400+
/* write err, then update state */
401+
virt_wmb();
400402
state.req->state = xb_req_state_got_reply;
401403
wake_up(&state.req->wq);
402404
}

0 commit comments

Comments
 (0)