dm: fix mutex lock issue in tpm_rbc.c

In function crb_reg_write() in tpm_rbc.c
 'tpm_vdev->request_mutex' will potentially kept
 in locked state after crb_reg_write() returns.

Tracked-On: #3825
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Yadong Qi <yadong.qi@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Yonghua Huang 2019-10-15 13:40:20 +08:00 committed by wenlingz
parent 73ac285ec3
commit e7ef57a9f1

View File

@ -333,12 +333,10 @@ static void crb_reg_write(struct tpm_crb_vdev *tpm_vdev, uint64_t addr, int size
if (pthread_cond_signal(&tpm_vdev->request_cond)) {
DPRINTF("ERROR: Failed to wait condition\n");
break;
}
if (pthread_mutex_unlock(&tpm_vdev->request_mutex)) {
DPRINTF("ERROR: Failed to release mutex lock\n");
break;
}
}
break;