summaryrefslogtreecommitdiff
path: root/drivers/xen
diff options
context:
space:
mode:
authorDongli Zhang <dongli.zhang@oracle.com>2020-03-04 01:14:23 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-25 10:25:49 +0300
commit5d33ba6f385f3cb9790b707df6ea93839e7d2cf9 (patch)
tree2025fa4f82fb325446b154686c8fffb6098c8e4e /drivers/xen
parent7a79e217e3a59afd95bd8a92e4ab9b92ee73868d (diff)
downloadlinux-5d33ba6f385f3cb9790b707df6ea93839e7d2cf9.tar.xz
xenbus: req->err should be updated before req->state
[ Upstream commit 8130b9d5b5abf26f9927b487c15319a187775f34 ] 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 <dongli.zhang@oracle.com> Link: https://lore.kernel.org/r/20200303221423.21962-2-dongli.zhang@oracle.com Reviewed-by: Julien Grall <jgrall@amazon.com> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/xen')
-rw-r--r--drivers/xen/xenbus/xenbus_comms.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/xen/xenbus/xenbus_comms.c b/drivers/xen/xenbus/xenbus_comms.c
index 852ed161fc2a..eb5151fc8efa 100644
--- a/drivers/xen/xenbus/xenbus_comms.c
+++ b/drivers/xen/xenbus/xenbus_comms.c
@@ -397,6 +397,8 @@ static int process_writes(void)
if (state.req->state == xb_req_state_aborted)
kfree(state.req);
else {
+ /* write err, then update state */
+ virt_wmb();
state.req->state = xb_req_state_got_reply;
wake_up(&state.req->wq);
}