diff options
author | Russ Gorby <russ.gorby@intel.com> | 2012-08-13 08:45:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-16 15:03:30 -0400 |
commit | 88ed2a60610974443335c924d7cb8e5dcf9dbdc1 (patch) | |
tree | 9093338b0334d53b992c956edc9c4d091ddebef3 /drivers/tty/n_gsm.c | |
parent | 329e56780e514a7ab607bcb51a52ab0dc2669414 (diff) |
n_gsm: memory leak in uplink error path
Uplink (TX) network data will go through gsm_dlci_data_output_framed
there is a bug where if memory allocation fails, the skb which
has already been pulled off the list will be lost.
In addition TX skbs were being processed in LIFO order
Fixed the memory leak, and changed to FIFO order processing
Signed-off-by: Russ Gorby <russ.gorby@intel.com>
Tested-by: Kappel, LaurentX <laurentx.kappel@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Cc: Showjumping <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/n_gsm.c')
-rw-r--r-- | drivers/tty/n_gsm.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index a8c82f5d769b..3e210a430fb3 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c | |||
@@ -868,7 +868,7 @@ static int gsm_dlci_data_output_framed(struct gsm_mux *gsm, | |||
868 | 868 | ||
869 | /* dlci->skb is locked by tx_lock */ | 869 | /* dlci->skb is locked by tx_lock */ |
870 | if (dlci->skb == NULL) { | 870 | if (dlci->skb == NULL) { |
871 | dlci->skb = skb_dequeue(&dlci->skb_list); | 871 | dlci->skb = skb_dequeue_tail(&dlci->skb_list); |
872 | if (dlci->skb == NULL) | 872 | if (dlci->skb == NULL) |
873 | return 0; | 873 | return 0; |
874 | first = 1; | 874 | first = 1; |
@@ -892,8 +892,11 @@ static int gsm_dlci_data_output_framed(struct gsm_mux *gsm, | |||
892 | 892 | ||
893 | /* FIXME: need a timer or something to kick this so it can't | 893 | /* FIXME: need a timer or something to kick this so it can't |
894 | get stuck with no work outstanding and no buffer free */ | 894 | get stuck with no work outstanding and no buffer free */ |
895 | if (msg == NULL) | 895 | if (msg == NULL) { |
896 | skb_queue_tail(&dlci->skb_list, dlci->skb); | ||
897 | dlci->skb = NULL; | ||
896 | return -ENOMEM; | 898 | return -ENOMEM; |
899 | } | ||
897 | dp = msg->data; | 900 | dp = msg->data; |
898 | 901 | ||
899 | if (dlci->adaption == 4) { /* Interruptible framed (Packetised Data) */ | 902 | if (dlci->adaption == 4) { /* Interruptible framed (Packetised Data) */ |