James, On Wed, May 30, 2018 at 08:13:15PM +0300, Jarkko Sakkinen wrote: > On Wed, May 23, 2018 at 04:50:03PM +0300, Jarkko Sakkinen wrote: > > On Tue, May 22, 2018 at 02:37:18PM -0700, Tadeusz Struk wrote: > > > There is a race condition in tpm_common_write function allowing > > > two threads on the same /dev/tpm<N>, or two different applications > > > on the same /dev/tpmrm<N> to overwrite each other commands/responses. > > > Fixed this by taking the priv->buffer_mutex early in the function. > > > > > > Also converted the priv->data_pending from atomic to a regular size_t > > > type. There is no need for it to be atomic since it is only touched > > > under the protection of the priv->buffer_mutex. > > > > > > v2: convert data_pending from atomic to a regular size_t type. > > > > > > Signed-off-by: Tadeusz Struk <tadeusz.struk@xxxxxxxxx> > > > --- > > > > The changel log should be here in diff stat (i.e. at this point) so that > > the change log does not get pulled into the final commit message. > > > > /Jarkko > > I pushed it now with appropriate tags, please check. > > /Jarkko Should I make a follow up PR for 4.18 with only this fix included? /Jarkko