linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tpm: fix wrong return value in tpm_pcr_extend
@ 2020-04-14 11:42 Tianjia Zhang
  2020-04-14 11:55 ` Roberto Sassu
  2020-04-14 20:26 ` Jerry Snitselaar
  0 siblings, 2 replies; 6+ messages in thread
From: Tianjia Zhang @ 2020-04-14 11:42 UTC (permalink / raw)
  To: peterhuewe, jarkko.sakkinen, jgg, arnd, gregkh, zhang.jia
  Cc: linux-integrity, linux-kernel, tianjia.zhang

For the algorithm that does not match the bank, a positive
value EINVAL is returned here. I think this is a typo error.
It is necessary to return an error value.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
 drivers/char/tpm/tpm-interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index a438b1206fcb..1621ce818705 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -323,7 +323,7 @@ int tpm_pcr_extend(struct tpm_chip *chip, u32 pcr_idx,
 
 	for (i = 0; i < chip->nr_allocated_banks; i++) {
 		if (digests[i].alg_id != chip->allocated_banks[i].alg_id) {
-			rc = EINVAL;
+			rc = -EINVAL;
 			goto out;
 		}
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH] tpm: fix wrong return value in tpm_pcr_extend
  2020-04-14 11:42 [PATCH] tpm: fix wrong return value in tpm_pcr_extend Tianjia Zhang
@ 2020-04-14 11:55 ` Roberto Sassu
  2020-04-14 19:35   ` Jarkko Sakkinen
  2020-04-14 20:26 ` Jerry Snitselaar
  1 sibling, 1 reply; 6+ messages in thread
From: Roberto Sassu @ 2020-04-14 11:55 UTC (permalink / raw)
  To: Tianjia Zhang, peterhuewe, jarkko.sakkinen, jgg, arnd, gregkh, zhang.jia
  Cc: linux-integrity, linux-kernel, Silviu Vlasceanu

> -----Original Message-----
> From: linux-integrity-owner@vger.kernel.org [mailto:linux-integrity-
> owner@vger.kernel.org] On Behalf Of Tianjia Zhang
> Sent: Tuesday, April 14, 2020 1:42 PM
> To: peterhuewe@gmx.de; jarkko.sakkinen@linux.intel.com; jgg@ziepe.ca;
> arnd@arndb.de; gregkh@linuxfoundation.org; zhang.jia@linux.alibaba.com
> Cc: linux-integrity@vger.kernel.org; linux-kernel@vger.kernel.org;
> tianjia.zhang@linux.alibaba.com
> Subject: [PATCH] tpm: fix wrong return value in tpm_pcr_extend
> 
> For the algorithm that does not match the bank, a positive
> value EINVAL is returned here. I think this is a typo error.
> It is necessary to return an error value.

Yes, thanks.

Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com>

Roberto

HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063
Managing Director: Li Peng, Li Jian, Shi Yanli


> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> ---
>  drivers/char/tpm/tpm-interface.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-
> interface.c
> index a438b1206fcb..1621ce818705 100644
> --- a/drivers/char/tpm/tpm-interface.c
> +++ b/drivers/char/tpm/tpm-interface.c
> @@ -323,7 +323,7 @@ int tpm_pcr_extend(struct tpm_chip *chip, u32
> pcr_idx,
> 
>  	for (i = 0; i < chip->nr_allocated_banks; i++) {
>  		if (digests[i].alg_id != chip->allocated_banks[i].alg_id) {
> -			rc = EINVAL;
> +			rc = -EINVAL;
>  			goto out;
>  		}
>  	}
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tpm: fix wrong return value in tpm_pcr_extend
  2020-04-14 11:55 ` Roberto Sassu
@ 2020-04-14 19:35   ` Jarkko Sakkinen
  2020-04-14 20:26     ` Jerry Snitselaar
  0 siblings, 1 reply; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-04-14 19:35 UTC (permalink / raw)
  To: Roberto Sassu
  Cc: Tianjia Zhang, peterhuewe, jgg, arnd, gregkh, zhang.jia,
	linux-integrity, linux-kernel, Silviu Vlasceanu

On Tue, Apr 14, 2020 at 11:55:43AM +0000, Roberto Sassu wrote:
> > -----Original Message-----
> > From: linux-integrity-owner@vger.kernel.org [mailto:linux-integrity-
> > owner@vger.kernel.org] On Behalf Of Tianjia Zhang
> > Sent: Tuesday, April 14, 2020 1:42 PM
> > To: peterhuewe@gmx.de; jarkko.sakkinen@linux.intel.com; jgg@ziepe.ca;
> > arnd@arndb.de; gregkh@linuxfoundation.org; zhang.jia@linux.alibaba.com
> > Cc: linux-integrity@vger.kernel.org; linux-kernel@vger.kernel.org;
> > tianjia.zhang@linux.alibaba.com
> > Subject: [PATCH] tpm: fix wrong return value in tpm_pcr_extend
> > 
> > For the algorithm that does not match the bank, a positive
> > value EINVAL is returned here. I think this is a typo error.
> > It is necessary to return an error value.
> 
> Yes, thanks.
> 
> Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com>

Happen to have the commit ID at hand for fixes?

Thanks.

/Jarkko

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tpm: fix wrong return value in tpm_pcr_extend
  2020-04-14 19:35   ` Jarkko Sakkinen
@ 2020-04-14 20:26     ` Jerry Snitselaar
  2020-04-16 16:11       ` Jarkko Sakkinen
  0 siblings, 1 reply; 6+ messages in thread
From: Jerry Snitselaar @ 2020-04-14 20:26 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Roberto Sassu, Tianjia Zhang, peterhuewe, jgg, arnd, gregkh,
	zhang.jia, linux-integrity, linux-kernel, Silviu Vlasceanu

On Tue Apr 14 20, Jarkko Sakkinen wrote:
>On Tue, Apr 14, 2020 at 11:55:43AM +0000, Roberto Sassu wrote:
>> > -----Original Message-----
>> > From: linux-integrity-owner@vger.kernel.org [mailto:linux-integrity-
>> > owner@vger.kernel.org] On Behalf Of Tianjia Zhang
>> > Sent: Tuesday, April 14, 2020 1:42 PM
>> > To: peterhuewe@gmx.de; jarkko.sakkinen@linux.intel.com; jgg@ziepe.ca;
>> > arnd@arndb.de; gregkh@linuxfoundation.org; zhang.jia@linux.alibaba.com
>> > Cc: linux-integrity@vger.kernel.org; linux-kernel@vger.kernel.org;
>> > tianjia.zhang@linux.alibaba.com
>> > Subject: [PATCH] tpm: fix wrong return value in tpm_pcr_extend
>> >
>> > For the algorithm that does not match the bank, a positive
>> > value EINVAL is returned here. I think this is a typo error.
>> > It is necessary to return an error value.
>>
>> Yes, thanks.
>>
>> Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com>
>
>Happen to have the commit ID at hand for fixes?
>
>Thanks.
>
>/Jarkko
>

9f75c8224631 ("KEYS: trusted: correctly initialize digests and fix locking issue")


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tpm: fix wrong return value in tpm_pcr_extend
  2020-04-14 11:42 [PATCH] tpm: fix wrong return value in tpm_pcr_extend Tianjia Zhang
  2020-04-14 11:55 ` Roberto Sassu
@ 2020-04-14 20:26 ` Jerry Snitselaar
  1 sibling, 0 replies; 6+ messages in thread
From: Jerry Snitselaar @ 2020-04-14 20:26 UTC (permalink / raw)
  To: Tianjia Zhang
  Cc: peterhuewe, jarkko.sakkinen, jgg, arnd, gregkh, zhang.jia,
	linux-integrity, linux-kernel

On Tue Apr 14 20, Tianjia Zhang wrote:
>For the algorithm that does not match the bank, a positive
>value EINVAL is returned here. I think this is a typo error.
>It is necessary to return an error value.
>
>Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>

Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>

>---
> drivers/char/tpm/tpm-interface.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
>index a438b1206fcb..1621ce818705 100644
>--- a/drivers/char/tpm/tpm-interface.c
>+++ b/drivers/char/tpm/tpm-interface.c
>@@ -323,7 +323,7 @@ int tpm_pcr_extend(struct tpm_chip *chip, u32 pcr_idx,
>
> 	for (i = 0; i < chip->nr_allocated_banks; i++) {
> 		if (digests[i].alg_id != chip->allocated_banks[i].alg_id) {
>-			rc = EINVAL;
>+			rc = -EINVAL;
> 			goto out;
> 		}
> 	}
>-- 
>2.17.1
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tpm: fix wrong return value in tpm_pcr_extend
  2020-04-14 20:26     ` Jerry Snitselaar
@ 2020-04-16 16:11       ` Jarkko Sakkinen
  0 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2020-04-16 16:11 UTC (permalink / raw)
  To: Roberto Sassu, Tianjia Zhang, peterhuewe, jgg, arnd, gregkh,
	zhang.jia, linux-integrity, linux-kernel, Silviu Vlasceanu

On Tue, Apr 14, 2020 at 01:26:15PM -0700, Jerry Snitselaar wrote:
> On Tue Apr 14 20, Jarkko Sakkinen wrote:
> > On Tue, Apr 14, 2020 at 11:55:43AM +0000, Roberto Sassu wrote:
> > > > -----Original Message-----
> > > > From: linux-integrity-owner@vger.kernel.org [mailto:linux-integrity-
> > > > owner@vger.kernel.org] On Behalf Of Tianjia Zhang
> > > > Sent: Tuesday, April 14, 2020 1:42 PM
> > > > To: peterhuewe@gmx.de; jarkko.sakkinen@linux.intel.com; jgg@ziepe.ca;
> > > > arnd@arndb.de; gregkh@linuxfoundation.org; zhang.jia@linux.alibaba.com
> > > > Cc: linux-integrity@vger.kernel.org; linux-kernel@vger.kernel.org;
> > > > tianjia.zhang@linux.alibaba.com
> > > > Subject: [PATCH] tpm: fix wrong return value in tpm_pcr_extend
> > > >
> > > > For the algorithm that does not match the bank, a positive
> > > > value EINVAL is returned here. I think this is a typo error.
> > > > It is necessary to return an error value.
> > > 
> > > Yes, thanks.
> > > 
> > > Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com>
> > 
> > Happen to have the commit ID at hand for fixes?
> > 
> > Thanks.
> > 
> > /Jarkko
> > 
> 
> 9f75c8224631 ("KEYS: trusted: correctly initialize digests and fix locking issue")

Thanks.

Also added:

Cc: stable@vger.kernel.org # 5.4.x

/Jarkko

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-16 16:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-14 11:42 [PATCH] tpm: fix wrong return value in tpm_pcr_extend Tianjia Zhang
2020-04-14 11:55 ` Roberto Sassu
2020-04-14 19:35   ` Jarkko Sakkinen
2020-04-14 20:26     ` Jerry Snitselaar
2020-04-16 16:11       ` Jarkko Sakkinen
2020-04-14 20:26 ` Jerry Snitselaar

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).