diff options
author | Dan Carpenter <error27@gmail.com> | 2010-05-25 05:37:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-06-04 16:37:17 -0400 |
commit | 328be395a396b1333b56e04571365dc614c96e46 (patch) | |
tree | e4266351b4641c44f43747e776964d6321f10d3d /drivers/char | |
parent | e59e2bd9e85604ad601ec7dd056baffcd6ad56a0 (diff) |
TTY/n_gsm: potential double lock
In gsm_dlci_data_kick() we call gsm_dlci_data_sweep() with the
"gsm->tx_lock" held so we can't lock it again inside
gsm_dlci_data_sweep(). I removed that lock from and added one to
gsmld_write_wakeup() instead. The sweep function is only called from
those two places.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/n_gsm.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/char/n_gsm.c b/drivers/char/n_gsm.c index c4161d5e053d..e4089c432f15 100644 --- a/drivers/char/n_gsm.c +++ b/drivers/char/n_gsm.c | |||
@@ -904,9 +904,7 @@ static void gsm_dlci_data_sweep(struct gsm_mux *gsm) | |||
904 | int len; | 904 | int len; |
905 | /* Priority ordering: We should do priority with RR of the groups */ | 905 | /* Priority ordering: We should do priority with RR of the groups */ |
906 | int i = 1; | 906 | int i = 1; |
907 | unsigned long flags; | ||
908 | 907 | ||
909 | spin_lock_irqsave(&gsm->tx_lock, flags); | ||
910 | while (i < NUM_DLCI) { | 908 | while (i < NUM_DLCI) { |
911 | struct gsm_dlci *dlci; | 909 | struct gsm_dlci *dlci; |
912 | 910 | ||
@@ -927,7 +925,6 @@ static void gsm_dlci_data_sweep(struct gsm_mux *gsm) | |||
927 | if (len == 0) | 925 | if (len == 0) |
928 | i++; | 926 | i++; |
929 | } | 927 | } |
930 | spin_unlock_irqrestore(&gsm->tx_lock, flags); | ||
931 | } | 928 | } |
932 | 929 | ||
933 | /** | 930 | /** |
@@ -2230,12 +2227,16 @@ static int gsmld_open(struct tty_struct *tty) | |||
2230 | static void gsmld_write_wakeup(struct tty_struct *tty) | 2227 | static void gsmld_write_wakeup(struct tty_struct *tty) |
2231 | { | 2228 | { |
2232 | struct gsm_mux *gsm = tty->disc_data; | 2229 | struct gsm_mux *gsm = tty->disc_data; |
2230 | unsigned long flags; | ||
2233 | 2231 | ||
2234 | /* Queue poll */ | 2232 | /* Queue poll */ |
2235 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 2233 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
2236 | gsm_data_kick(gsm); | 2234 | gsm_data_kick(gsm); |
2237 | if (gsm->tx_bytes < TX_THRESH_LO) | 2235 | if (gsm->tx_bytes < TX_THRESH_LO) { |
2236 | spin_lock_irqsave(&gsm->tx_lock, flags); | ||
2238 | gsm_dlci_data_sweep(gsm); | 2237 | gsm_dlci_data_sweep(gsm); |
2238 | spin_unlock_irqrestore(&gsm->tx_lock, flags); | ||
2239 | } | ||
2239 | } | 2240 | } |
2240 | 2241 | ||
2241 | /** | 2242 | /** |