mbox series

[0/1,SRU,F,OEM-5.6,OEM-OSP1-B] UBUNTU: SAUCE: tpm: fix TIS locality timeout problems

Message ID 20200602141325.21074-1-ivan.hu@canonical.com
Headers show
Series UBUNTU: SAUCE: tpm: fix TIS locality timeout problems | expand

Message

Ivan Hu June 2, 2020, 2:13 p.m. UTC
BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1881710

[Impact]
It has been reported that some TIS based TPMs are giving unexpected errors when
using the O_NONBLOCK path of the TPM device. The problem is that some TPMs
don't like it when you get and then relinquish a locality
(as the tpm_try_get_ops()/tpm_put_ops() pair does) without sending a command.
This currently happens all the time in the O_NONBLOCK write path.
This affects Nuvoton TPMs and was a regression caused by the patch d23d12484307
("tpm: fix invalid locking in NONBLOCKING mode").
PatchLink: https://patchwork.kernel.org/patch/11576453/

[Fix]
Fix this by moving the tpm_try_get_ops()
further down the code to after the O_NONBLOCK determination is made.
This is safe because the priv->buffer_mutex still protects the priv
state being modified.

[Regression Risk]
Low. This patch only for fix the patch d23d12484307 ("tpm: fix invalid locking
in NONBLOCKING mode").

James Bottomley (1):
  tpm: fix TIS locality timeout problems

 drivers/char/tpm/tpm-dev-common.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

Comments

Colin Ian King June 2, 2020, 2:17 p.m. UTC | #1
On 02/06/2020 15:13, Ivan Hu wrote:
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1881710
> 
> [Impact]
> It has been reported that some TIS based TPMs are giving unexpected errors when
> using the O_NONBLOCK path of the TPM device. The problem is that some TPMs
> don't like it when you get and then relinquish a locality
> (as the tpm_try_get_ops()/tpm_put_ops() pair does) without sending a command.
> This currently happens all the time in the O_NONBLOCK write path.
> This affects Nuvoton TPMs and was a regression caused by the patch d23d12484307
> ("tpm: fix invalid locking in NONBLOCKING mode").
> PatchLink: https://patchwork.kernel.org/patch/11576453/
> 
> [Fix]
> Fix this by moving the tpm_try_get_ops()
> further down the code to after the O_NONBLOCK determination is made.
> This is safe because the priv->buffer_mutex still protects the priv
> state being modified.
> 
> [Regression Risk]
> Low. This patch only for fix the patch d23d12484307 ("tpm: fix invalid locking
> in NONBLOCKING mode").
> 
> James Bottomley (1):
>   tpm: fix TIS locality timeout problems
> 
>  drivers/char/tpm/tpm-dev-common.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 

These look sane to me.

Acked-by: Colin Ian King <colin.king@canonical.com>
Marcelo Henrique Cerri June 2, 2020, 4:21 p.m. UTC | #2
Acked-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Khalid Elmously June 5, 2020, 5:58 a.m. UTC | #3
Changed the BugLink to use the short-form URL: https://bugs.launchpad.net/bugs/1881710

On 2020-06-02 22:13:23 , Ivan Hu wrote:
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1881710
> 
> [Impact]
> It has been reported that some TIS based TPMs are giving unexpected errors when
> using the O_NONBLOCK path of the TPM device. The problem is that some TPMs
> don't like it when you get and then relinquish a locality
> (as the tpm_try_get_ops()/tpm_put_ops() pair does) without sending a command.
> This currently happens all the time in the O_NONBLOCK write path.
> This affects Nuvoton TPMs and was a regression caused by the patch d23d12484307
> ("tpm: fix invalid locking in NONBLOCKING mode").
> PatchLink: https://patchwork.kernel.org/patch/11576453/
> 
> [Fix]
> Fix this by moving the tpm_try_get_ops()
> further down the code to after the O_NONBLOCK determination is made.
> This is safe because the priv->buffer_mutex still protects the priv
> state being modified.
> 
> [Regression Risk]
> Low. This patch only for fix the patch d23d12484307 ("tpm: fix invalid locking
> in NONBLOCKING mode").
> 
> James Bottomley (1):
>   tpm: fix TIS locality timeout problems
> 
>  drivers/char/tpm/tpm-dev-common.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 
> -- 
> 2.17.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Timo Aaltonen June 12, 2020, 7:58 a.m. UTC | #4
On 2.6.2020 17.13, Ivan Hu wrote:
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1881710
> 
> [Impact]
> It has been reported that some TIS based TPMs are giving unexpected errors when
> using the O_NONBLOCK path of the TPM device. The problem is that some TPMs
> don't like it when you get and then relinquish a locality
> (as the tpm_try_get_ops()/tpm_put_ops() pair does) without sending a command.
> This currently happens all the time in the O_NONBLOCK write path.
> This affects Nuvoton TPMs and was a regression caused by the patch d23d12484307
> ("tpm: fix invalid locking in NONBLOCKING mode").
> PatchLink: https://patchwork.kernel.org/patch/11576453/
> 
> [Fix]
> Fix this by moving the tpm_try_get_ops()
> further down the code to after the O_NONBLOCK determination is made.
> This is safe because the priv->buffer_mutex still protects the priv
> state being modified.
> 
> [Regression Risk]
> Low. This patch only for fix the patch d23d12484307 ("tpm: fix invalid locking
> in NONBLOCKING mode").
> 
> James Bottomley (1):
>   tpm: fix TIS locality timeout problems
> 
>  drivers/char/tpm/tpm-dev-common.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 

applied to oem-5.6-next, thanks
AceLan Kao June 12, 2020, 8:09 a.m. UTC | #5
Acked-By: AceLan Kao <acelan.kao@canonical.com>
Seth Forshee June 22, 2020, 7:39 p.m. UTC | #6
On Tue, Jun 02, 2020 at 10:13:23PM +0800, Ivan Hu wrote:
> BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1881710
> 
> [Impact]
> It has been reported that some TIS based TPMs are giving unexpected errors when
> using the O_NONBLOCK path of the TPM device. The problem is that some TPMs
> don't like it when you get and then relinquish a locality
> (as the tpm_try_get_ops()/tpm_put_ops() pair does) without sending a command.
> This currently happens all the time in the O_NONBLOCK write path.
> This affects Nuvoton TPMs and was a regression caused by the patch d23d12484307
> ("tpm: fix invalid locking in NONBLOCKING mode").
> PatchLink: https://patchwork.kernel.org/patch/11576453/
> 
> [Fix]
> Fix this by moving the tpm_try_get_ops()
> further down the code to after the O_NONBLOCK determination is made.
> This is safe because the priv->buffer_mutex still protects the priv
> state being modified.
> 
> [Regression Risk]
> Low. This patch only for fix the patch d23d12484307 ("tpm: fix invalid locking
> in NONBLOCKING mode").

Please remember that sauce patches should also be submitted for the
devel/unstable kernels whenever applicable.

Applied to unstable/master, thanks!