aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/gigaset
diff options
context:
space:
mode:
authorTilman Schmidt <tilman@imap.cc>2014-10-11 07:46:30 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-14 15:05:35 -0400
commit86f8ef2c4802ac9dbe0c8c1c12670bd915a13013 (patch)
treeea00760072953a797e6d42ef0ce252cd9556d937 /drivers/isdn/gigaset
parent340184b35ac8786bdb574d2c8ce8e4f1269ec4da (diff)
isdn/gigaset: fix usb_gigaset write_cmd result race
In usb_gigaset function gigaset_write_cmd(), the length field of the command buffer structure could be cleared by the transmit tasklet before it was used for the function's return value. Fix by copying to a local variable before scheduling the tasklet. Signed-off-by: Tilman Schmidt <tilman@imap.cc> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/gigaset')
-rw-r--r--drivers/isdn/gigaset/usb-gigaset.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c
index 82e91ba1acd3..a8e652dac54d 100644
--- a/drivers/isdn/gigaset/usb-gigaset.c
+++ b/drivers/isdn/gigaset/usb-gigaset.c
@@ -497,6 +497,7 @@ static int send_cb(struct cardstate *cs, struct cmdbuf_t *cb)
497static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb) 497static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb)
498{ 498{
499 unsigned long flags; 499 unsigned long flags;
500 int len;
500 501
501 gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? 502 gigaset_dbg_buffer(cs->mstate != MS_LOCKED ?
502 DEBUG_TRANSCMD : DEBUG_LOCKCMD, 503 DEBUG_TRANSCMD : DEBUG_LOCKCMD,
@@ -515,10 +516,11 @@ static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb)
515 spin_unlock_irqrestore(&cs->cmdlock, flags); 516 spin_unlock_irqrestore(&cs->cmdlock, flags);
516 517
517 spin_lock_irqsave(&cs->lock, flags); 518 spin_lock_irqsave(&cs->lock, flags);
519 len = cb->len;
518 if (cs->connected) 520 if (cs->connected)
519 tasklet_schedule(&cs->write_tasklet); 521 tasklet_schedule(&cs->write_tasklet);
520 spin_unlock_irqrestore(&cs->lock, flags); 522 spin_unlock_irqrestore(&cs->lock, flags);
521 return cb->len; 523 return len;
522} 524}
523 525
524static int gigaset_write_room(struct cardstate *cs) 526static int gigaset_write_room(struct cardstate *cs)