From f139281b60ad455a948479913c469cab40e757be Mon Sep 17 00:00:00 2001 From: Manoj Prabhu B Date: Wed, 28 Sep 2016 18:48:38 +0530 Subject: diag: Fix race condition while closing SMD This patch extends protection while closing SMD/socket while feature mask processing. CRs-Fixed: 1059771 Change-Id: Icdf27dce5b3eb7cfc4a7686f044195db13a81a58 Signed-off-by: Manoj Prabhu B --- drivers/char/diag/diagfwd_peripheral.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/diag/diagfwd_peripheral.c b/drivers/char/diag/diagfwd_peripheral.c index 731b42c56998..40fdcbaaf31a 100644 --- a/drivers/char/diag/diagfwd_peripheral.c +++ b/drivers/char/diag/diagfwd_peripheral.c @@ -651,13 +651,12 @@ void diagfwd_close_transport(uint8_t transport, uint8_t peripheral) break; default: return; - } + mutex_lock(&driver->diagfwd_channel_mutex); fwd_info = &early_init_info[transport][peripheral]; if (fwd_info->p_ops && fwd_info->p_ops->close) fwd_info->p_ops->close(fwd_info->ctxt); - mutex_lock(&driver->diagfwd_channel_mutex); fwd_info = &early_init_info[transport_open][peripheral]; dest_info = &peripheral_info[TYPE_CNTL][peripheral]; dest_info->inited = 1; -- cgit v1.2.3