Re: [PATCH v4 1/2] tpm: Unify the send callback behaviour

From: Jarkko Sakkinen
Date: Fri Feb 08 2019 - 14:01:07 EST


On Fri, Feb 08, 2019 at 01:12:34PM -0500, Stefan Berger wrote:
> On 2/8/19 1:08 PM, Jarkko Sakkinen wrote:
> > The send() callback should never return length as it does not in every
> > driver except tpm_crb in the success case. The reason is that the main
> > transmit functionality only cares about whether the transmit was
> > successful or not and ignores the count completely.
> >
> > Cc: stable@xxxxxxxxxxxxxxx
> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxxxxxxxx>
>
> Reviewed-by: Stefan Berger <stefanb@xxxxxxxxxxxxx>
>
> Let me know when you put it into your tree, I'll give it a spin while I am
> at it. :-)

Thank you Stefan! I also add your suggested-by to the first commit
because you pointed out the problem.

It all looks now legit, but just in case I'll add a check for the return
value to tpm_try_transmit() and a warning if it is not zero in the
success case (and after that zeroing of rc).

That check can be removed when I do v5.3 pull request. That should
enough window to catch any potential issues and check will ensure that
kernel won't fail even there was something forgotten.

Alexander, I'll push this version now to the master and next with the
additional check described in this commit, but will add your tags
after you have time to test.

Thanks alot!

/Jarkko