diff options
author | Manu Abraham <manu@linuxtv.org> | 2005-11-08 21:35:36 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 07:56:03 -0800 |
commit | d28d57629ffcd30e11a6085e15ee1327fea60b60 (patch) | |
tree | c3286f3f4a2eeec76cff805b5d06a455bab9e8eb /drivers/media/dvb/bt8xx/dst_ca.c | |
parent | 2cbeddc976645262dbe036d6ec0825f96af70da3 (diff) | |
download | op-kernel-dev-d28d57629ffcd30e11a6085e15ee1327fea60b60.zip op-kernel-dev-d28d57629ffcd30e11a6085e15ee1327fea60b60.tar.gz |
[PATCH] dvb: dst: protect the read/write commands with a mutex
We need to protect the read/write commands with a mutex.
Bug reported by Henrik Sjoberg <henke@epact.se>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Cc: Johannes Stezenbach <js@linuxtv.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/dvb/bt8xx/dst_ca.c')
-rw-r--r-- | drivers/media/dvb/bt8xx/dst_ca.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index 38c72894..e6541af 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c @@ -81,36 +81,41 @@ static int dst_ci_command(struct dst_state* state, u8 * data, u8 *ca_string, u8 { u8 reply; + down(&state->dst_mutex); dst_comm_init(state); msleep(65); if (write_dst(state, data, len)) { dprintk(verbose, DST_CA_INFO, 1, " Write not successful, trying to recover"); dst_error_recovery(state); - return -1; + goto error; } if ((dst_pio_disable(state)) < 0) { dprintk(verbose, DST_CA_ERROR, 1, " DST PIO disable failed."); - return -1; + goto error; } if (read_dst(state, &reply, GET_ACK) < 0) { dprintk(verbose, DST_CA_INFO, 1, " Read not successful, trying to recover"); dst_error_recovery(state); - return -1; + goto error; } if (read) { if (! dst_wait_dst_ready(state, LONG_DELAY)) { dprintk(verbose, DST_CA_NOTICE, 1, " 8820 not ready"); - return -1; + goto error; } if (read_dst(state, ca_string, 128) < 0) { /* Try to make this dynamic */ dprintk(verbose, DST_CA_INFO, 1, " Read not successful, trying to recover"); dst_error_recovery(state); - return -1; + goto error; } } - + up(&state->dst_mutex); return 0; + +error: + up(&state->dst_mutex); + return -EIO; } |