aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/most/hdm-dim2
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2016-06-13 16:24:23 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-15 20:18:55 +0200
commit6ebb3727ead795a4dc80f99d2e8065dbc041ccce (patch)
tree2b4e79efd363ccba69ec209909c273704c82ba7f /drivers/staging/most/hdm-dim2
parentstaging: most: v4l2-aim: remove unnecessary spaces (diff)
downloadlinux-dev-6ebb3727ead795a4dc80f99d2e8065dbc041ccce.tar.xz
linux-dev-6ebb3727ead795a4dc80f99d2e8065dbc041ccce.zip
staging: most: dim2-hdm: fix race condition when closing a channel
This patch fixes race between the function poison_channel that clears the state is_initialized and the tasklet function dim2_tasklet_fn that checks the state is_initialized. Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de> Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/most/hdm-dim2')
-rw-r--r--drivers/staging/most/hdm-dim2/dim2_hdm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c b/drivers/staging/most/hdm-dim2/dim2_hdm.c
index a36449551513..89a66bb914e4 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c
@@ -705,12 +705,14 @@ static int poison_channel(struct most_interface *most_iface, int ch_idx)
if (!hdm_ch->is_initialized)
return -EPERM;
+ tasklet_disable(&dim2_tasklet);
spin_lock_irqsave(&dim_lock, flags);
hal_ret = dim_destroy_channel(&hdm_ch->ch);
hdm_ch->is_initialized = false;
if (ch_idx == dev->atx_idx)
dev->atx_idx = -1;
spin_unlock_irqrestore(&dim_lock, flags);
+ tasklet_enable(&dim2_tasklet);
if (hal_ret != DIM_NO_ERROR) {
pr_err("HAL Failed to close channel %s\n", hdm_ch->name);
ret = -EFAULT;