diff options
author | Paul Fulghum <paulkf@microgate.com> | 2012-12-03 12:13:24 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-16 00:52:23 -0500 |
commit | a6b68a69fa89daeddc6ca6bb90b6f19a86ed7a9f (patch) | |
tree | 0570429793adb5fba1a3a1f24ee5d669d92c8daa /drivers/tty/synclink_gt.c | |
parent | 55c7c0fdc5aae43ca7eda3adb22ab782634fcb24 (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/synclink_gt.c')
-rw-r--r-- | drivers/tty/synclink_gt.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c index aba1e59f4a88..62a0db7ead07 100644 --- a/drivers/tty/synclink_gt.c +++ b/drivers/tty/synclink_gt.c | |||
@@ -317,8 +317,7 @@ struct slgt_info { | |||
317 | unsigned char *tx_buf; | 317 | unsigned char *tx_buf; |
318 | int tx_count; | 318 | int tx_count; |
319 | 319 | ||
320 | char flag_buf[MAX_ASYNC_BUFFER_SIZE]; | 320 | char *flag_buf; |
321 | char char_buf[MAX_ASYNC_BUFFER_SIZE]; | ||
322 | bool drop_rts_on_tx_done; | 321 | bool drop_rts_on_tx_done; |
323 | struct _input_signal_events input_signal_events; | 322 | struct _input_signal_events input_signal_events; |
324 | 323 | ||
@@ -3355,11 +3354,24 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, | |||
3355 | return retval; | 3354 | return retval; |
3356 | } | 3355 | } |
3357 | 3356 | ||
3357 | /* | ||
3358 | * allocate buffers used for calling line discipline receive_buf | ||
3359 | * directly in synchronous mode | ||
3360 | * note: add 5 bytes to max frame size to allow appending | ||
3361 | * 32-bit CRC and status byte when configured to do so | ||
3362 | */ | ||
3358 | static int alloc_tmp_rbuf(struct slgt_info *info) | 3363 | static int alloc_tmp_rbuf(struct slgt_info *info) |
3359 | { | 3364 | { |
3360 | info->tmp_rbuf = kmalloc(info->max_frame_size + 5, GFP_KERNEL); | 3365 | info->tmp_rbuf = kmalloc(info->max_frame_size + 5, GFP_KERNEL); |
3361 | if (info->tmp_rbuf == NULL) | 3366 | if (info->tmp_rbuf == NULL) |
3362 | return -ENOMEM; | 3367 | return -ENOMEM; |
3368 | /* unused flag buffer to satisfy receive_buf calling interface */ | ||
3369 | info->flag_buf = kzalloc(info->max_frame_size + 5, GFP_KERNEL); | ||
3370 | if (!info->flag_buf) { | ||
3371 | kfree(info->tmp_rbuf); | ||
3372 | info->tmp_rbuf = NULL; | ||
3373 | return -ENOMEM; | ||
3374 | } | ||
3363 | return 0; | 3375 | return 0; |
3364 | } | 3376 | } |
3365 | 3377 | ||
@@ -3367,6 +3379,8 @@ static void free_tmp_rbuf(struct slgt_info *info) | |||
3367 | { | 3379 | { |
3368 | kfree(info->tmp_rbuf); | 3380 | kfree(info->tmp_rbuf); |
3369 | info->tmp_rbuf = NULL; | 3381 | info->tmp_rbuf = NULL; |
3382 | kfree(info->flag_buf); | ||
3383 | info->flag_buf = NULL; | ||
3370 | } | 3384 | } |
3371 | 3385 | ||
3372 | /* | 3386 | /* |