[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1355963920.9600.99.camel@xiaojin>
Date: Thu, 20 Dec 2012 08:38:40 +0800
From: Xiao Jin <jin.xiao@...el.com>
To: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
mingo@...e.hu, a.p.zijlstra@...llo.nl, rusty@...tcorp.com.au,
william.douglas@...el.com, sboyd@...eaurora.org,
gregkh@...uxfoundation.org, jslaby@...e.cz
Cc: vincentx.pillet@...el.com
Subject: [PATCH] n_gsm.c: add tx_lock in gsm_send
From: xiaojin <jin.xiao@...el.com>
Date: Wed, 19 Dec 2012 11:53:43 +0800
Subject: [PATCH] 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@...el.com>
---
drivers/tty/n_gsm.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
index dcc0430..4572117 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);
}
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists