Thread (9 messages) 9 messages, 2 authors, 2018-10-24

RE: [PATCH] tpm: tpm_try_transmit() refactor error flow.

From: Winkler, Tomas <hidden>
Date: 2018-10-23 14:16:20
Also in: linux-integrity, lkml, stable


On Sat, 20 Oct 2018, Winkler, Tomas wrote:
quoted
quoted
On Thu, 18 Oct 2018, Winkler, Tomas wrote:
quoted
quoted
-----Original Message-----
From: Jarkko Sakkinen [mailto:jarkko.sakkinen@linux.intel.com]
Sent: Thursday, October 18, 2018 03:15
To: Winkler, Tomas <redacted>
Cc: Jarkko Sakkinen <redacted>; Jason
Gunthorpe [off-list ref]; Nayna Jain [off-list ref];
Usyskin, Alexander [off-list ref]; Struk, Tadeusz
[off-list ref]; linux-integrity@vger.kernel.org;
linux-security- module@vger.kernel.org;
linux-kernel@vger.kernel.org; stable@vger.kernel.org
Subject: Re: [PATCH] tpm: tpm_try_transmit() refactor error flow.
bb> >>>> On Tue, 16 Oct 2018, Tomas Winkler wrote:
quoted
quoted
quoted
quoted
quoted
First, rename out_no_locality to out_locality for bailing out on
both
tpm_cmd_ready() and tpm_request_locality() failure.
This is unnecessary change and technically it is not a rename: the
commit message text and the code change do not match. Rename is
just a rename (i.e. change a variable name foo to bar).
I'm renaming the label because it doesn't match the code flow
anymore, I can change the commit message, but you please review the
code.
quoted
quoted
quoted
Tomas
The flow change is unnecessary and does not really have anything to
do with the bug fix.
What I see in the original code is that when
tpm_cmd_ready()  fails it's jumps to 'out' label and trying to do
tpm_go_idle() but instead it should just undoing the locality, so both
cmd_read and go idle had a wrong jump. I see both should  be fixed.

Earlier version was better than this and would have been fine
quoted
when taking account the remark from Jason.
So you are doing tpm_cmd_ready() change in order to prevent unnecessary
call to tpm_go_idle() that was previously i.e. before when that function
failed in jumped to out and called tpm_go_idle()?
This should be probably split into two commits if I understood right. You did
not have this updated mentioned in a changelog (there was no changelog).
I'm not sure why to do it in two steps, this addresses the same issue.
Have you checked that if these were separate commits they would have the
same fixes line? Why not use the label name 'out' as the same label handles
bot 'locality' and 'no_locality'?
To  the  out  label we jump after we are  done with locality and cmd read() before we jump to locality 'locality'.
We will need to add another variable to check If cmd_ready() was called or not in order to get rid of the extran label,
it's not internally tracked so far.
I'm not sure what is better, I prefer this short fix, as the transmit() has to be rewritten anyway at some point, the recursion what is there is not helthy. 

Thanks
Tomas
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help