From: Julien Grall Date: Thu, 24 Jun 2021 08:08:56 +0000 (+0100) Subject: tools/xenstored: delay_request: don't assume conn->in == in X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~408 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=361f1deb42ec32ea97df7e79f8df12bfc2d0e049;p=xen.git tools/xenstored: delay_request: don't assume conn->in == in delay_request() is currently assuming that the request delayed is always conn->in. This is currently correct, but it is a call for a latent bug as the function allows the caller to specify any request. To prevent any future surprise, check if the request delayed is the current one. Fixes: c5ca1404b4 ("tools/xenstore: add support for delaying execution of a xenstore request") Signed-off-by: Julien Grall Reviewed-by: Luca Fancellu Reviewed-by: Juergen Gross --- diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index 4c0d6e1874..3286eb55d3 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -306,7 +306,9 @@ int delay_request(struct connection *conn, struct buffered_data *in, delayed_requests++; list_add(&req->list, &conn->delayed); - conn->in = NULL; + /* Unlink the request from conn if this is the current one */ + if (conn->in == in) + conn->in = NULL; return 0; }