diff options
author | Paul Fulghum <paulkf@microgate.com> | 2012-12-03 11:13:24 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-15 21:52:23 -0800 |
commit | a6b68a69fa89daeddc6ca6bb90b6f19a86ed7a9f (patch) | |
tree | 0570429793adb5fba1a3a1f24ee5d669d92c8daa /drivers/tty/synclink.c | |
parent | 55c7c0fdc5aae43ca7eda3adb22ab782634fcb24 (diff) | |
download | op-kernel-dev-a6b68a69fa89daeddc6ca6bb90b6f19a86ed7a9f.zip op-kernel-dev-a6b68a69fa89daeddc6ca6bb90b6f19a86ed7a9f.tar.gz |
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.c')
-rw-r--r-- | drivers/tty/synclink.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c index 9e071f6..d42b661 100644 --- a/drivers/tty/synclink.c +++ b/drivers/tty/synclink.c @@ -291,8 +291,7 @@ struct mgsl_struct { bool lcr_mem_requested; u32 misc_ctrl_value; - char flag_buf[MAX_ASYNC_BUFFER_SIZE]; - char char_buf[MAX_ASYNC_BUFFER_SIZE]; + char *flag_buf; bool drop_rts_on_tx_done; bool loopmode_insert_requested; @@ -3898,7 +3897,13 @@ static int mgsl_alloc_intermediate_rxbuffer_memory(struct mgsl_struct *info) info->intermediate_rxbuffer = kmalloc(info->max_frame_size, GFP_KERNEL | GFP_DMA); if ( info->intermediate_rxbuffer == NULL ) return -ENOMEM; - + /* unused flag buffer to satisfy receive_buf calling interface */ + info->flag_buf = kzalloc(info->max_frame_size, GFP_KERNEL); + if (!info->flag_buf) { + kfree(info->intermediate_rxbuffer); + info->intermediate_rxbuffer = NULL; + return -ENOMEM; + } return 0; } /* end of mgsl_alloc_intermediate_rxbuffer_memory() */ @@ -3917,6 +3922,8 @@ static void mgsl_free_intermediate_rxbuffer_memory(struct mgsl_struct *info) { kfree(info->intermediate_rxbuffer); info->intermediate_rxbuffer = NULL; + kfree(info->flag_buf); + info->flag_buf = NULL; } /* end of mgsl_free_intermediate_rxbuffer_memory() */ |