File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,8 @@ static int process_msg(void)
313
313
req -> msg .type = state .msg .type ;
314
314
req -> msg .len = state .msg .len ;
315
315
req -> body = state .body ;
316
+ /* write body, then update state */
317
+ virt_wmb ();
316
318
req -> state = xb_req_state_got_reply ;
317
319
req -> cb (req );
318
320
} else
Original file line number Diff line number Diff line change @@ -191,8 +191,11 @@ static bool xenbus_ok(void)
191
191
192
192
static bool test_reply (struct xb_req_data * req )
193
193
{
194
- if (req -> state == xb_req_state_got_reply || !xenbus_ok ())
194
+ if (req -> state == xb_req_state_got_reply || !xenbus_ok ()) {
195
+ /* read req->state before all other fields */
196
+ virt_rmb ();
195
197
return true;
198
+ }
196
199
197
200
/* Make sure to reread req->state each time. */
198
201
barrier ();
@@ -202,7 +205,7 @@ static bool test_reply(struct xb_req_data *req)
202
205
203
206
static void * read_reply (struct xb_req_data * req )
204
207
{
205
- while ( req -> state != xb_req_state_got_reply ) {
208
+ do {
206
209
wait_event (req -> wq , test_reply (req ));
207
210
208
211
if (!xenbus_ok ())
@@ -216,7 +219,7 @@ static void *read_reply(struct xb_req_data *req)
216
219
if (req -> err )
217
220
return ERR_PTR (req -> err );
218
221
219
- }
222
+ } while ( req -> state != xb_req_state_got_reply );
220
223
221
224
return req -> body ;
222
225
}
You can’t perform that action at this time.
0 commit comments