aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/synclinkmp.c
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/tty/synclinkmp.c
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/tty/synclinkmp.c')
-rw-r--r--drivers/tty/synclinkmp.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c
index fd43fb6f7cee..33b7314cc6c7 100644
--- a/drivers/tty/synclinkmp.c
+++ b/drivers/tty/synclinkmp.c
@@ -262,8 +262,7 @@ typedef struct _synclinkmp_info {
262 bool sca_statctrl_requested; 262 bool sca_statctrl_requested;
263 263
264 u32 misc_ctrl_value; 264 u32 misc_ctrl_value;
265 char flag_buf[MAX_ASYNC_BUFFER_SIZE]; 265 char *flag_buf;
266 char char_buf[MAX_ASYNC_BUFFER_SIZE];
267 bool drop_rts_on_tx_done; 266 bool drop_rts_on_tx_done;
268 267
269 struct _input_signal_events input_signal_events; 268 struct _input_signal_events input_signal_events;
@@ -3553,6 +3552,13 @@ static int alloc_tmp_rx_buf(SLMP_INFO *info)
3553 info->tmp_rx_buf = kmalloc(info->max_frame_size, GFP_KERNEL); 3552 info->tmp_rx_buf = kmalloc(info->max_frame_size, GFP_KERNEL);
3554 if (info->tmp_rx_buf == NULL) 3553 if (info->tmp_rx_buf == NULL)
3555 return -ENOMEM; 3554 return -ENOMEM;
3555 /* unused flag buffer to satisfy receive_buf calling interface */
3556 info->flag_buf = kzalloc(info->max_frame_size, GFP_KERNEL);
3557 if (!info->flag_buf) {
3558 kfree(info->tmp_rx_buf);
3559 info->tmp_rx_buf = NULL;
3560 return -ENOMEM;
3561 }
3556 return 0; 3562 return 0;
3557} 3563}
3558 3564
@@ -3560,6 +3566,8 @@ static void free_tmp_rx_buf(SLMP_INFO *info)
3560{ 3566{
3561 kfree(info->tmp_rx_buf); 3567 kfree(info->tmp_rx_buf);
3562 info->tmp_rx_buf = NULL; 3568 info->tmp_rx_buf = NULL;
3569 kfree(info->flag_buf);
3570 info->flag_buf = NULL;
3563} 3571}
3564 3572
3565static int claim_resources(SLMP_INFO *info) 3573static int claim_resources(SLMP_INFO *info)