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]
Message-ID: <765f9bfc-db7c-5db7-16cd-50156b2579e9@linux.alibaba.com>
Date:   Mon, 10 May 2021 09:23:43 +0800
From:   乱石 <zhangliguang@...ux.alibaba.com>
To:     Jarkko Sakkinen <jarkko@...nel.org>
Cc:     Peter Huewe <peterhuewe@....de>, Jason Gunthorpe <jgg@...pe.ca>,
        linux-integrity@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tpm_tis_spi: set default probe function if device id not
 match

在 2021/5/10 4:39, Jarkko Sakkinen 写道:
> On Sat, May 08, 2021 at 10:46:57AM +0800, 乱石 wrote:
>> Hi,
>>
>> 在 2021/5/8 10:01, Jarkko Sakkinen 写道:
>>> On Fri, May 07, 2021 at 10:52:55PM +0800, Liguang Zhang wrote:
>>>> In DSDT table, TPM _CID was SMO0768, and no _HID definition. After a
>>>> kernel upgrade from 4.19 to 5.10, TPM probe function was changed which
>>>> causes device probe fails. In order to make newer kernel to be
>>>> compatible with the older acpi definition, it would be best set default
>>>> probe function.
>>>>
>>>> Signed-off-by: Liguang Zhang <zhangliguang@...ux.alibaba.com>
>>>> ---
>>>>    drivers/char/tpm/tpm_tis_spi_main.c | 12 ++++++++----
>>>>    1 file changed, 8 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/drivers/char/tpm/tpm_tis_spi_main.c b/drivers/char/tpm/tpm_tis_spi_main.c
>>>> index 3856f6ebcb34..da632a582621 100644
>>>> --- a/drivers/char/tpm/tpm_tis_spi_main.c
>>>> +++ b/drivers/char/tpm/tpm_tis_spi_main.c
>>>> @@ -240,10 +240,14 @@ static int tpm_tis_spi_driver_probe(struct spi_device *spi)
>>>>    	tpm_tis_spi_probe_func probe_func;
>>>>    	probe_func = of_device_get_match_data(&spi->dev);
>>>> -	if (!probe_func && spi_dev_id)
>>>> -		probe_func = (tpm_tis_spi_probe_func)spi_dev_id->driver_data;
>>>> -	if (!probe_func)
>>>> -		return -ENODEV;
>>>> +	if (!probe_func) {
>>>> +		if (spi_dev_id) {
>>>> +			probe_func = (tpm_tis_spi_probe_func)spi_dev_id->driver_data;
>>>> +			if (!probe_func)
>>>> +				return -ENODEV;
>>> Perhaps also hear fallback to tpm_tis_spi_probe?
>>
>> Yes, I do not think of a good way. Do you have any suggestions?
> So, I just think that when you have this part:
>
>
> if (!probe_func) {
> 	if (spi_dev_id) {
>                  probe_func = (tpm_tis_spi_probe_func)spi_dev_id->driver_data;
>                  if (!probe_func)
>                          return -ENODEV;
>
> Why in here would not you also want to fallback to tpm_tis_spi_probe?

Thanks, I got it. If spi_dev_id exists, prob_func is NULL, I think it's 
not reasonable , but not neccessarily correct.

In this scenario, maybe can also fallback to tpm_tis_spi_probe.


Liguang

>
> /Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ