DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
* [dpdk-dev] [PATCH] kni: fix possible buffer overflow
@ 2019-07-11 12:35 Ferruh Yigit
  2019-07-11 15:33 ` Stephen Hemminger
  0 siblings, 1 reply; 5+ messages in thread
From: Ferruh Yigit @ 2019-07-11 12:35 UTC (permalink / raw)
  To: dev; +Cc: Yangchao Zhou

'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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: fix possible buffer overflow
  2019-07-11 12:35 [dpdk-dev] [PATCH] kni: fix possible buffer overflow Ferruh Yigit
@ 2019-07-11 15:33 ` Stephen Hemminger
  2019-07-18 21:24   ` Thomas Monjalon
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2019-07-11 15:33 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Yangchao Zhou

On Thu, 11 Jul 2019 13:35:07 +0100
Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> '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);
>  

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: fix possible buffer overflow
  2019-07-11 15:33 ` Stephen Hemminger
@ 2019-07-18 21:24   ` Thomas Monjalon
  2019-07-18 21:35     ` Thomas Monjalon
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2019-07-18 21:24 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Stephen Hemminger, Yangchao Zhou

11/07/2019 17:33, Stephen Hemminger:
> On Thu, 11 Jul 2019 13:35:07 +0100
> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> 
> > '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>
> 
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>

Applied, thanks



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: fix possible buffer overflow
  2019-07-18 21:24   ` Thomas Monjalon
@ 2019-07-18 21:35     ` Thomas Monjalon
  2019-07-19 18:34       ` Ferruh Yigit
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2019-07-18 21:35 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev, Stephen Hemminger, Yangchao Zhou

18/07/2019 23:24, Thomas Monjalon:
> 11/07/2019 17:33, Stephen Hemminger:
> > On Thu, 11 Jul 2019 13:35:07 +0100
> > Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > 
> > > '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>
> > 
> > Acked-by: Stephen Hemminger <stephen@networkplumber.org>
> 
> Applied, thanks

I hope these lines are correct:

    Fixes: d89a58dfe90b ("kni: support chained mbufs")
    Cc: stable@dpdk.org





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: fix possible buffer overflow
  2019-07-18 21:35     ` Thomas Monjalon
@ 2019-07-19 18:34       ` Ferruh Yigit
  0 siblings, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2019-07-19 18:34 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Stephen Hemminger, Yangchao Zhou

On 7/18/2019 10:35 PM, Thomas Monjalon wrote:
> 18/07/2019 23:24, Thomas Monjalon:
>> 11/07/2019 17:33, Stephen Hemminger:
>>> On Thu, 11 Jul 2019 13:35:07 +0100
>>> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>>
>>>> '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>
>>>
>>> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
>>
>> Applied, thanks
> 
> I hope these lines are correct:
> 
>     Fixes: d89a58dfe90b ("kni: support chained mbufs")
>     Cc: stable@dpdk.org

Thanks for updating it, even before this commit the related code was wrong I
think, but agree that this commit should have fixed it, so agreed with the fixes
line.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-11 12:35 [dpdk-dev] [PATCH] kni: fix possible buffer overflow Ferruh Yigit
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

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org dpdk-dev@archiver.kernel.org
	public-inbox-index dpdk-dev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox