aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/n_gsm.c
diff options
context:
space:
mode:
authorxiaojin <jin.xiao@intel.com>2012-12-18 22:53:43 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-16 00:54:41 -0500
commitf96f7f7f39af53274d98aa9c29d6fa4d122218a4 (patch)
tree072676b629e4ac854d41562e09c5667d3edf1c1c /drivers/tty/n_gsm.c
parent5425e03f97d1e5847372aae0b895d8d1c9bf2741 (diff)
n_gsm.c: add tx_lock in gsm_send
All the call to gsm->output should be in the tx_lock, that could avoid potential race from MUX level. But we have no tx_lock in gsm_send. This patch is to add tx_lock in gsm_send. Signed-off-by: xiaojin <jin.xiao@intel.com> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/n_gsm.c')
-rw-r--r--drivers/tty/n_gsm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index dcc0430a49c8..4572117988f8 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
@@ -573,6 +573,7 @@ static void gsm_send(struct gsm_mux *gsm, int addr, int cr, int control)
573 int len; 573 int len;
574 u8 cbuf[10]; 574 u8 cbuf[10];
575 u8 ibuf[3]; 575 u8 ibuf[3];
576 unsigned long flags;
576 577
577 switch (gsm->encoding) { 578 switch (gsm->encoding) {
578 case 0: 579 case 0:
@@ -602,7 +603,9 @@ static void gsm_send(struct gsm_mux *gsm, int addr, int cr, int control)
602 WARN_ON(1); 603 WARN_ON(1);
603 return; 604 return;
604 } 605 }
606 spin_lock_irqsave(&gsm->tx_lock, flags);
605 gsm->output(gsm, cbuf, len); 607 gsm->output(gsm, cbuf, len);
608 spin_unlock_irqrestore(&gsm->tx_lock, flags);
606 gsm_print_packet("-->", addr, cr, control, NULL, 0); 609 gsm_print_packet("-->", addr, cr, control, NULL, 0);
607} 610}
608 611