kni: fix segmented mbuf data overflow
authorFerruh Yigit <ferruh.yigit@intel.com>
Thu, 11 Jul 2019 12:35:07 +0000 (13:35 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 18 Jul 2019 21:29:57 +0000 (23:29 +0200)
'kni_net_rx_lo_fifo()' can get segmented buffers, using 'pkt_len' for
that case will be wrong and some values can cause buffer overflow
in destination mbuf data.

Fixes: d89a58dfe90b ("kni: support chained mbufs")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
kernel/linux/kni/kni_net.c

index a736407..7bd3a9f 100644 (file)
@@ -438,7 +438,7 @@ kni_net_rx_lo_fifo(struct kni_dev *kni)
                /* Copy mbufs */
                for (i = 0; i < num; i++) {
                        kva = pa2kva(kni->pa[i]);
-                       len = kva->pkt_len;
+                       len = kva->data_len;
                        data_kva = kva2data_kva(kva);
                        kni->va[i] = pa2va(kni->pa[i], kva);