From 6e10dbdfb656d7a259ec3a333a3dac04dc9b3d25 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Wed, 4 Jun 2014 11:37:08 -0500 Subject: [PATCH] wctc4xxp: Constrain RTP payload to 500 bytes. This is a limitation of the DTE firmware that normally would result in dropped packets on the firmware. If the driver knows it is going to be dropped it should drop it. Signed-off-by: Shaun Ruffell Signed-off-by: Russ Meyerriecks --- drivers/dahdi/wctc4xxp/base.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/dahdi/wctc4xxp/base.c b/drivers/dahdi/wctc4xxp/base.c index 75e727a..e289066 100644 --- a/drivers/dahdi/wctc4xxp/base.c +++ b/drivers/dahdi/wctc4xxp/base.c @@ -2292,6 +2292,7 @@ wctc4xxp_write(struct file *file, const char __user *frame, u32 samples; unsigned long flags; const unsigned long MAX_SAMPLES_IN_FLIGHT = 640; + const unsigned long MAX_RTP_PAYLOAD = 500; BUG_ON(!cpvt); BUG_ON(!wc); @@ -2309,11 +2310,10 @@ wctc4xxp_write(struct file *file, const char __user *frame, return -EINVAL; } - if (unlikely(count > SFRAME_SIZE - sizeof(struct rtp_packet))) { + if (count > MAX_RTP_PAYLOAD) { DTE_DEBUG(DTE_DEBUG_GENERAL, - "Cannot transcode packet of %Zu bytes. This exceeds the " \ - "maximum size of %Zu bytes.\n", count, - SFRAME_SIZE - sizeof(struct rtp_packet)); + "Cannot transcode packet of %Zu bytes. This exceeds the maximum size of %lu bytes.\n", + count, MAX_RTP_PAYLOAD); return -EINVAL; }