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