DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: dev@dpdk.org
Cc: Yangchao Zhou <zhouyates@gmail.com>
Subject: [dpdk-dev] [PATCH] kni: fix possible buffer overflow
Date: Thu, 11 Jul 2019 13:35:07 +0100	[thread overview]
Message-ID: <20190711123508.45219-1-ferruh.yigit@intel.com> (raw)

'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.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 kernel/linux/kni/kni_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c
index ad8365877..84341ac92 100644
--- a/kernel/linux/kni/kni_net.c
+++ b/kernel/linux/kni/kni_net.c
@@ -435,7 +435,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);
 
-- 
2.21.0


             reply	other threads:[~2019-07-11 12:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11 12:35 Ferruh Yigit [this message]
2019-07-11 15:33 ` Stephen Hemminger
2019-07-18 21:24   ` Thomas Monjalon
2019-07-18 21:35     ` Thomas Monjalon
2019-07-19 18:34       ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190711123508.45219-1-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=zhouyates@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).