summaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_output.c
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2019-08-22 18:40:28 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-09-02 11:55:53 +0000
commit404e24de56c278507171a5af290169e6fc12d9fd (patch)
tree1a3183d59d7c469233f8ab2b1fff2f0b8285781a /src/vnet/interface_output.c
parent43a5b7cc44596fea37a9b7ab62f49eb40c402f22 (diff)
gso: fix segmentation when gso_size greater than vlib buffer size
Type: fix Ticket: VPP-1751 Change-Id: I5ffb078492adc97374290de404f2ec0102b75184 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> (cherry picked from commit 3f1964d2d2847c5307694fe8daea0a7eef1e2733)
Diffstat (limited to 'src/vnet/interface_output.c')
-rw-r--r--src/vnet/interface_output.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c
index 60953b0f35a..21a1f84b36e 100644
--- a/src/vnet/interface_output.c
+++ b/src/vnet/interface_output.c
@@ -235,8 +235,11 @@ tso_alloc_tx_bufs (vlib_main_t * vm,
vlib_buffer_t * b0, u32 n_bytes_b0, u16 l234_sz,
u16 gso_size)
{
+ u16 size =
+ clib_min (gso_size, vlib_buffer_get_default_data_size (vm) - l234_sz);
+
/* rounded-up division */
- u16 n_bufs = (n_bytes_b0 - l234_sz + (gso_size - 1)) / gso_size;
+ u16 n_bufs = (n_bytes_b0 - l234_sz + (size - 1)) / size;
u16 n_alloc;
ASSERT (n_bufs > 0);