From: Nayna <nayna@linux.vnet.ibm.com>
To: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
Stefan Berger <stefanb@linux.vnet.ibm.com>,
tpmdd-devel@lists.sourceforge.net,
linux-security-module@vger.kernel.org
Subject: Re: [PATCH 2/2] tpm: Fix error code handling after tpm_bios_log_setup
Date: Tue, 22 Nov 2016 14:34:12 +0530 [thread overview]
Message-ID: <58340A0C.3050706@linux.vnet.ibm.com> (raw)
In-Reply-To: <20161121171530.GB22237@obsidianresearch.com>
On 11/21/2016 10:45 PM, Jason Gunthorpe wrote:
> On Mon, Nov 21, 2016 at 12:06:20AM +0530, Nayna wrote:
>>> rc = tpm_bios_log_setup(chip);
>>> - if (rc == -ENODEV)
>>> + if (rc != 0 && rc != -ENODEV)
>>> return rc;
>>
>> This will return in case of -EFAULT as well, where the check is that log is
>> already initialized. Do we want to fail the probe here as well ?
>>
>> -EFAULT is returned from tpm_read_log() as below:
>
> That is fine, we should never read the log twice.
>
>>> index fb603a74cbd29e..2a15b866ac257a 100644
>>> +++ b/drivers/char/tpm/tpm_eventlog.c
>>> @@ -377,14 +377,21 @@ static int tpm_read_log(struct tpm_chip *chip)
>>> }
>>>
>>> rc = tpm_read_log_acpi(chip);
>>
>> This is to understand..
>> It can return -ENOMEM error here, contd below...
>>
>>> - if ((rc == 0) || (rc == -ENOMEM))
>>> + if (rc != -ENODEV)
>>> return rc;
>>>
>>> - rc = tpm_read_log_of(chip);
>>> -
>>> - return rc;
>>> + return tpm_read_log_of(chip);
>>
>> So, in ACPI if -ENOMEM error is returned, it will continue to
>> tpm_read_log_of(chip), which will return -ENODEV. So, -ENOMEM error is now
>> masked with -ENODEV error.
>
> No, if acpi is -ENOMEM then 'if (rc != -ENODEV)' is true and it
> returns -ENOMEM.
Yeah, I missed it. Sorry.
>
>>> sizep = of_get_property(np, "linux,sml-size", NULL);
>>> - if (sizep == NULL)
>>> + basep = of_get_property(np, "linux,sml-base", NULL);
>>> + if (sizep == NULL && basep == NULL)
>>> + return -ENODEV;
>>> + if (sizep == NULL || basep == NULL)
>>> return -EIO;
>>
>> To confirm my understanding,
>>
>> For -ENODEV, it means that both properties are not supported, so event log
>> is not supported.
>
> Yes
>
>> For -EIO , it means that event log is supported but there is some failure in
>> getting one of them, so should fail the probe.
>> Is my understanding right ?
>
> Yes
Thanks for explaining. Looks good now.
Thanks & Regards,
- Nayna
>
> Jason
>
next prev parent reply other threads:[~2016-11-22 9:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-18 0:30 [PATCH 1/2] tpm: Check for parent device being NULL Stefan Berger
[not found] ` <1479429004-7962-1-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-11-18 0:30 ` [PATCH 2/2] tpm: Fix error code handling after tpm_bios_log_setup Stefan Berger
[not found] ` <1479429004-7962-2-git-send-email-stefanb-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2016-11-18 12:26 ` Nayna
2016-11-18 15:52 ` Jarkko Sakkinen
2016-11-19 18:22 ` Jason Gunthorpe
2016-11-20 9:46 ` Jarkko Sakkinen
2016-11-20 9:47 ` Jarkko Sakkinen
2016-11-20 12:14 ` Jarkko Sakkinen
[not found] ` <20161120121451.awcraondhcvzpbig-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-11-21 17:55 ` Jason Gunthorpe
2016-11-21 20:30 ` Jarkko Sakkinen
[not found] ` <20161121175520.GA24191-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-11-21 20:32 ` Jarkko Sakkinen
2016-11-21 20:36 ` Jarkko Sakkinen
2016-11-21 20:37 ` Jason Gunthorpe
[not found] ` <20161121203708.GA7294-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-11-21 20:46 ` Jarkko Sakkinen
2016-11-21 20:56 ` Jason Gunthorpe
2016-11-20 18:36 ` Nayna
2016-11-21 17:15 ` Jason Gunthorpe
2016-11-21 20:29 ` Jarkko Sakkinen
2016-11-22 16:37 ` Jason Gunthorpe
[not found] ` <20161122163720.GB3956-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-11-22 16:48 ` Jarkko Sakkinen
2016-11-22 9:04 ` Nayna [this message]
2016-11-18 15:52 ` [PATCH 1/2] tpm: Check for parent device being NULL 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=58340A0C.3050706@linux.vnet.ibm.com \
--to=nayna@linux.vnet.ibm.com \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=jgunthorpe@obsidianresearch.com \
--cc=linux-security-module@vger.kernel.org \
--cc=stefanb@linux.vnet.ibm.com \
--cc=tpmdd-devel@lists.sourceforge.net \
/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).