From: Stefan Berger <stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [PATCH] tpm: vtpm_proxy: Do not access host's event log
Date: Sun, 20 Nov 2016 09:46:12 -0500 [thread overview]
Message-ID: <1f165294-07bc-6c06-3a3b-be596fc12d58@linux.vnet.ibm.com> (raw)
In-Reply-To: <20161119183255.GB22775-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
On 11/19/2016 01:32 PM, Jason Gunthorpe wrote:
> On Thu, Nov 17, 2016 at 06:15:20PM -0500, Stefan Berger wrote:
>
>>>> Further, I had the impression that the error unwinding following -ENODEV has
>>>> an issue related to sysfs.
>>> I don't follow this comment..
>> I have encountered this error here, which gets masked when applying the
>> previously shown patch.
> If tpm_chip_register fails vtpm must not call tpm_chip_unregister:
>
>> [ 58.271017] [<ffffffff8155bd32>] dpm_sysfs_remove+0x22/0x60
>> [ 58.271017] [<ffffffff8154e438>] device_del+0x58/0x280
>> [ 58.271017] [<ffffffffa024c020>] tpm_chip_unregister+0x40/0xb0 [tpm]
>> [ 58.271017] [<ffffffffa0292360>] vtpm_proxy_fops_release+0x40/0x60 [tpm_vtpm_proxy]
> So, this is a vtpm thing I missed for 'tpm: Get rid of TPM_CHIP_FLAG_REGISTERED'
>
> Does this do the trick?
Yes, it does the trick.
I tested this now with your other fix-patch applied to Jarkko's tree. I
injected a fault by returning -EIO from tpm_read_log_acpi(), which
otherwise would cause the crash.
Tested-by: Stefan Berger <stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
>
> diff --git a/drivers/char/tpm/tpm_vtpm_proxy.c b/drivers/char/tpm/tpm_vtpm_proxy.c
> index 3d6f6ca81def75..d3a41f9d65c85c 100644
> --- a/drivers/char/tpm/tpm_vtpm_proxy.c
> +++ b/drivers/char/tpm/tpm_vtpm_proxy.c
> @@ -42,6 +42,7 @@ struct proxy_dev {
> long state; /* internal state */
> #define STATE_OPENED_FLAG BIT(0)
> #define STATE_WAIT_RESPONSE_FLAG BIT(1) /* waiting for emulator response */
> +#define STATE_REGISTERED_FLAG BIT(2)
>
> size_t req_len; /* length of queued TPM request */
> size_t resp_len; /* length of queued TPM response */
> @@ -372,6 +373,7 @@ static void vtpm_proxy_work(struct work_struct *work)
> if (rc)
> goto err;
>
> + proxy_dev->state |= STATE_REGISTERED_FLAG;
> return;
>
> err:
> @@ -516,7 +518,8 @@ static void vtpm_proxy_delete_device(struct proxy_dev *proxy_dev)
> */
> vtpm_proxy_fops_undo_open(proxy_dev);
>
> - tpm_chip_unregister(proxy_dev->chip);
> + if (proxy_dev->state & STATE_REGISTERED_FLAG)
> + tpm_chip_unregister(proxy_dev->chip);
>
> vtpm_proxy_delete_proxy_dev(proxy_dev);
> }
>
------------------------------------------------------------------------------
next prev parent reply other threads:[~2016-11-20 14:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-16 14:24 [PATCH] tpm: vtpm_proxy: Do not access host's event log Stefan Berger
[not found] ` <1479306245-14456-1-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-11-16 15:37 ` Jarkko Sakkinen
[not found] ` <20161116153731.pmmnxiai7ouuj6qf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-11-16 15:41 ` Stefan Berger
[not found] ` <3a38ddc6-1758-ae82-3df3-9cc55906880d-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-11-16 17:07 ` Stefan Berger
[not found] ` <65f392b6-5141-c726-dacb-a1649ea215de-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-11-16 20:07 ` Jason Gunthorpe
[not found] ` <20161116200759.GA19593-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-11-17 12:35 ` Stefan Berger
[not found] ` <ef1f954d-fc52-0522-01f7-b0e31ea14c59-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-11-17 18:10 ` Jason Gunthorpe
[not found] ` <20161117181006.GA26039-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-11-17 18:25 ` Stefan Berger
[not found] ` <c6e84bc7-151c-e698-e269-0ef1ebf3897b-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-11-17 18:33 ` Jason Gunthorpe
[not found] ` <20161117183328.GC26039-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-11-17 23:15 ` Stefan Berger
2016-11-17 23:43 ` Jarkko Sakkinen
[not found] ` <513da75c-6221-39ce-2718-19290c216ff1-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-11-19 18:32 ` Jason Gunthorpe
[not found] ` <20161119183255.GB22775-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-11-20 14:46 ` Stefan Berger [this message]
2016-11-22 6:07 ` Jarkko Sakkinen
[not found] ` <20161122060742.mtknarperpxdtqxv-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-11-22 6:09 ` Jarkko Sakkinen
2016-11-18 12:23 ` Nayna
2016-11-17 20:37 ` Jarkko Sakkinen
2016-11-18 14:11 ` Stefan Berger
[not found] ` <abef96f0-97e3-22e6-c63b-4be5622b4fc2-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-11-18 14:15 ` Stefan Berger
[not found] ` <77bf7806-5007-feb4-e4a0-fc94775a5271-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-11-18 16:58 ` Stefan Berger
2016-11-21 18:32 ` Jason Gunthorpe
2016-11-17 20:34 ` Jarkko Sakkinen
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=1f165294-07bc-6c06-3a3b-be596fc12d58@linux.vnet.ibm.com \
--to=stefanb-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
--cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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;
as well as URLs for NNTP newsgroup(s).