From: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH 7/7] vtpm Mini-Os domain: linux tpmbk bugfixes
Date: Wed, 25 Aug 2010 11:29:22 -0400 [thread overview]
Message-ID: <4C7536D2.4010305@jhuapl.edu> (raw)
[-- Attachment #1.1.1: Type: text/plain, Size: 548 bytes --]
Signed-off-by: Matthew Fioravante <matthew.fioravante@jhuapl.edu>
This patch is for the xen linux kernel. It was made against 2.6.18 but
is fairly simple and should apply cleanly to all of the xen kernels out
there.
This patch fixes a couple of race conditions in the linux tpmbk driver.
One of them is during startup and will cause the vtpm domains to fail to
start correctly. The other race condition happens during shutdown and
causes the vtpm tpmfrontend to release a shared page before the backend
driver has unmapped it.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: linux-tpmbk.patch --]
[-- Type: text/x-patch; name="linux-tpmbk.patch", Size: 1555 bytes --]
diff -r 5ad2a1476b3c -r 1dfbe5675b7a drivers/xen/tpmback/xenbus.c
--- a/drivers/xen/tpmback/xenbus.c Mon Jun 07 13:54:21 2010 -0400
+++ b/drivers/xen/tpmback/xenbus.c Wed Jul 07 13:38:42 2010 -0400
@@ -52,6 +52,18 @@
return res;
}
+static void tpmback_disconnect(struct xenbus_device *dev) {
+ struct backend_info *be = dev->dev.driver_data;
+
+ if (be->tpmif) {
+ be->tpmif->bi = NULL;
+ vtpm_release_packets(be->tpmif, 0);
+ tpmif_put(be->tpmif);
+ be->tpmif = NULL;
+ }
+ return;
+}
+
static int tpmback_remove(struct xenbus_device *dev)
{
struct backend_info *be = dev->dev.driver_data;
@@ -63,12 +75,7 @@
kfree(be->backend_watch.node);
be->backend_watch.node = NULL;
}
- if (be->tpmif) {
- be->tpmif->bi = NULL;
- vtpm_release_packets(be->tpmif, 0);
- tpmif_put(be->tpmif);
- be->tpmif = NULL;
- }
+ tpmback_disconnect(dev);
kfree(be);
dev->dev.driver_data = NULL;
return 0;
@@ -162,6 +169,7 @@
case XenbusStateUnknown: /* keep it here */
case XenbusStateClosed:
+ tpmback_disconnect(dev); /*Unmap shared pages first */
xenbus_switch_state(dev, XenbusStateClosed);
device_unregister(&be->dev->dev);
tpmback_remove(dev);
@@ -213,9 +221,10 @@
if (err)
xenbus_dev_fatal(be->dev, err, "end of transaction");
+ be->tpmif->status = CONNECTED;
err = xenbus_switch_state(dev, XenbusStateConnected);
- if (!err)
- be->tpmif->status = CONNECTED;
+ if (err)
+ be->tpmif->status = DISCONNECTED;
return;
abort:
xenbus_transaction_end(xbt, 1);
[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 2518 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2010-08-25 15:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4C7536D2.4010305@jhuapl.edu \
--to=matthew.fioravante@jhuapl.edu \
--cc=xen-devel@lists.xensource.com \
/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;
as well as URLs for NNTP newsgroup(s).