aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorPaul Fulghum <paulkf@microgate.com>2012-12-03 12:13:24 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-16 00:52:23 -0500
commita6b68a69fa89daeddc6ca6bb90b6f19a86ed7a9f (patch)
tree0570429793adb5fba1a3a1f24ee5d669d92c8daa /drivers/char
parent55c7c0fdc5aae43ca7eda3adb22ab782634fcb24 (diff)
synclink fix ldisc buffer argument
Fix call to line discipline receive_buf by synclink drivers. Dummy flag buffer argument is ignored by N_HDLC line discipline but might be of insufficient size if accessed by a different line discipline selected by mistake. flag buffer allocation now matches max size of data buffer. Unused char_buf buffers are removed. Signed-off-by: Paul Fulghum <paulkf@microgate.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/pcmcia/synclink_cs.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index b66eaa04f8cb..b2f35d786025 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -210,7 +210,7 @@ typedef struct _mgslpc_info {
210 char testing_irq; 210 char testing_irq;
211 unsigned int init_error; /* startup error (DIAGS) */ 211 unsigned int init_error; /* startup error (DIAGS) */
212 212
213 char flag_buf[MAX_ASYNC_BUFFER_SIZE]; 213 char *flag_buf;
214 bool drop_rts_on_tx_done; 214 bool drop_rts_on_tx_done;
215 215
216 struct _input_signal_events input_signal_events; 216 struct _input_signal_events input_signal_events;
@@ -2674,6 +2674,14 @@ static int rx_alloc_buffers(MGSLPC_INFO *info)
2674 if (info->rx_buf == NULL) 2674 if (info->rx_buf == NULL)
2675 return -ENOMEM; 2675 return -ENOMEM;
2676 2676
2677 /* unused flag buffer to satisfy receive_buf calling interface */
2678 info->flag_buf = kzalloc(info->max_frame_size, GFP_KERNEL);
2679 if (!info->flag_buf) {
2680 kfree(info->rx_buf);
2681 info->rx_buf = NULL;
2682 return -ENOMEM;
2683 }
2684
2677 rx_reset_buffers(info); 2685 rx_reset_buffers(info);
2678 return 0; 2686 return 0;
2679} 2687}
@@ -2682,6 +2690,8 @@ static void rx_free_buffers(MGSLPC_INFO *info)
2682{ 2690{
2683 kfree(info->rx_buf); 2691 kfree(info->rx_buf);
2684 info->rx_buf = NULL; 2692 info->rx_buf = NULL;
2693 kfree(info->flag_buf);
2694 info->flag_buf = NULL;
2685} 2695}
2686 2696
2687static int claim_resources(MGSLPC_INFO *info) 2697static int claim_resources(MGSLPC_INFO *info)