From f96f7f7f39af53274d98aa9c29d6fa4d122218a4 Mon Sep 17 00:00:00 2001 From: xiaojin Date: Wed, 19 Dec 2012 11:53:43 +0800 Subject: 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 Acked-by: Alan Cox Signed-off-by: Greg Kroah-Hartman --- drivers/tty/n_gsm.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/tty/n_gsm.c') 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) int len; u8 cbuf[10]; u8 ibuf[3]; + unsigned long flags; switch (gsm->encoding) { case 0: @@ -602,7 +603,9 @@ static void gsm_send(struct gsm_mux *gsm, int addr, int cr, int control) WARN_ON(1); return; } + spin_lock_irqsave(&gsm->tx_lock, flags); gsm->output(gsm, cbuf, len); + spin_unlock_irqrestore(&gsm->tx_lock, flags); gsm_print_packet("-->", addr, cr, control, NULL, 0); } -- cgit v1.2.3