* [PATCH 7/7] vtpm Mini-Os domain: linux tpmbk bugfixes
@ 2010-08-25 15:29 Matthew Fioravante
0 siblings, 0 replies; only message in thread
From: Matthew Fioravante @ 2010-08-25 15:29 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
[-- 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-08-25 15:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-25 15:29 [PATCH 7/7] vtpm Mini-Os domain: linux tpmbk bugfixes Matthew Fioravante
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).