From: Simon Gaiser <simon@invisiblethingslab.com>
To: xen-devel@lists.xenproject.org
Cc: Simon Gaiser <simon@invisiblethingslab.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Juergen Gross <jgross@suse.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/3] xen: xenbus: Catch closing of non existent transactions
Date: Thu, 15 Mar 2018 03:43:21 +0100 [thread overview]
Message-ID: <20180315024322.27429-2-simon@invisiblethingslab.com> (raw)
In-Reply-To: <20180315024322.27429-1-simon@invisiblethingslab.com>
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 <simon@invisiblethingslab.com>
---
drivers/xen/xenbus/xenbus_xs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
index 3f3b29398ab8..49a3874ae6bb 100644
--- a/drivers/xen/xenbus/xenbus_xs.c
+++ b/drivers/xen/xenbus/xenbus_xs.c
@@ -140,7 +140,9 @@ void xs_request_exit(struct xb_req_data *req)
spin_lock(&xs_state_lock);
xs_state_users--;
if ((req->type == XS_TRANSACTION_START && req->msg.type == XS_ERROR) ||
- req->type == XS_TRANSACTION_END)
+ (req->type == XS_TRANSACTION_END &&
+ !WARN_ON_ONCE(req->msg.type == XS_ERROR &&
+ !strcmp(req->body, "ENOENT"))))
xs_state_users--;
spin_unlock(&xs_state_lock);
--
2.16.2
next prev parent reply other threads:[~2018-03-15 2:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-15 2:43 [PATCH v2 1/3] xen: xenbus_dev_frontend: Fix XS_TRANSACTION_END handling Simon Gaiser
2018-03-15 2:43 ` Simon Gaiser [this message]
2018-03-15 10:34 ` [PATCH v2 2/3] xen: xenbus: Catch closing of non existent transactions Juergen Gross
2018-03-15 2:43 ` [PATCH v2 3/3] xen: xenbus_dev_frontend: Verify body of XS_TRANSACTION_END Simon Gaiser
2018-03-15 10:34 ` Juergen Gross
2018-03-15 10:33 ` [PATCH v2 1/3] xen: xenbus_dev_frontend: Fix XS_TRANSACTION_END handling Juergen Gross
2018-03-21 21:13 ` Boris Ostrovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180315024322.27429-2-simon@invisiblethingslab.com \
--to=simon@invisiblethingslab.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome