Skip to content

Commit b93008d

Browse files
HW42Boris Ostrovsky
authored andcommitted
xen: xenbus: Catch closing of non existent transactions
Users of the xenbus functions should never close a non existent transaction (for example by trying to closing the same transaction twice) but better catch it in xs_request_exit() than to corrupt the reference counter. Signed-off-by: Simon Gaiser <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent 2a22ee6 commit b93008d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/xen/xenbus/xenbus_xs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ void xs_request_exit(struct xb_req_data *req)
140140
spin_lock(&xs_state_lock);
141141
xs_state_users--;
142142
if ((req->type == XS_TRANSACTION_START && req->msg.type == XS_ERROR) ||
143-
req->type == XS_TRANSACTION_END)
143+
(req->type == XS_TRANSACTION_END &&
144+
!WARN_ON_ONCE(req->msg.type == XS_ERROR &&
145+
!strcmp(req->body, "ENOENT"))))
144146
xs_state_users--;
145147
spin_unlock(&xs_state_lock);
146148

0 commit comments

Comments
 (0)