lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 23 May 2023 10:45:07 +0800
From:   shaopeijie@...tc.cn
To:     pmenzel@...gen.mpg.de
Cc:     jarkko@...nel.org, peterhuewe@....de, jgg@...pe.ca,
        linux-integrity@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: Re: [PATCH v2] tpm_tis_spi: fix:release chip select when flow control fails

Thank you, Paul.

>Dear Peijie,
>
>
>Thank you for your patch.
>
>The fix: tag in your commit message summary is uncommon. I suggest:
>
>> tpm_tis_spi: Release chip select when flow control fails
>

I will change it in v3 version.

>
>Am 22.05.23 um 09:01 schrieb shaopeijie@...tc.cn:
>> From: Peijie Shao <shaopeijie@...tc.cn>
>> 
>> The failure paths in tpm_tis_spi_transfer() do not deactivate
>> chip select. Send an empty message (cs_select == 0) to overcome
>> this.
>
>Does the standard require to deactivate it?

Yes.
<TCG_PCClientTPMInterfaceSpecification_TIS__1-3_27_03212013.pdf>, section
6.4.2 Electrical Specification, Figure 4 Timing Diagram, describes the timing.

Moreover, when multi devices are sharing with the same SPI bus, only one cs can be 
activated simultaneously. If two or more cs are activated, corresponding devices 
may response at same time, cause bus conflicts.

>
>A note on your test setup would be nice to have in the commit message.
>
>> Signed-off-by: Peijie Shao <shaopeijie@...tc.cn>
>> ---
>> Changes since v1:
>>      1. Deactive cs all of the failure path, not only flow control.
>
>Deactivate

Sorry, will be fixed in v3 version.

>
>
>Kind regards,
>
>Paul
>
>
>>      2. change and update comments.
>> ---
>>   drivers/char/tpm/tpm_tis_spi_main.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>> 
>> diff --git a/drivers/char/tpm/tpm_tis_spi_main.c b/drivers/char/tpm/tpm_tis_spi_main.c
>> index 1f5207974..9bfaba092 100644
>> --- a/drivers/char/tpm/tpm_tis_spi_main.c
>> +++ b/drivers/char/tpm/tpm_tis_spi_main.c
>> @@ -136,6 +136,14 @@ int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
>>   	}
>>   
>>   exit:
>> +	if (ret < 0) {
>> +		/* Deactivate chip select */
>> +		memset(&spi_xfer, 0, sizeof(spi_xfer));
>> +		spi_message_init(&m);
>> +		spi_message_add_tail(&spi_xfer, &m);
>> +		spi_sync_locked(phy->spi_device, &m);
>> +	}
>> +
>>   	spi_bus_unlock(phy->spi_device->master);
>>   	return ret;
>>   }

Peijie, Shao


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ