public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH] tap: fix seq->p.count limit
Date: Wed, 9 Aug 2023 19:54:58 +1000	[thread overview]
Message-ID: <ZNNicrdG2jC7J22z@zatzit> (raw)
In-Reply-To: <20230809092342.2299907-1-lvivier@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1888 bytes --]

On Wed, Aug 09, 2023 at 11:23:42AM +0200, Laurent Vivier wrote:
> The number of items in pool_l4_t is defined to UIO_MAXIOV,
> not TAP_SEQS. TAP_SEQS is the number of the messages.
> 
> Fix the value used to compare seq->p.count with.
> 
> Fix: bb708111833e ("treewide: Packet abstraction with mandatory boundary checks")
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  tap.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tap.c b/tap.c
> index e034f9468267..69bd19a2a91a 100644
> --- a/tap.c
> +++ b/tap.c
> @@ -678,7 +678,7 @@ resume:
>  		seq->daddr.s_addr	= iph->daddr;			\
>  	} while (0)
>  
> -		if (seq && L4_MATCH(iph, uh, seq) && seq->p.count < TAP_SEQS)
> +		if (seq && L4_MATCH(iph, uh, seq) && seq->p.count < UIO_MAXIOV)
>  			goto append;
>  
>  		if (seq_count == TAP_SEQS)
> @@ -686,7 +686,7 @@ resume:
>  
>  		for (seq = tap4_l4 + seq_count - 1; seq >= tap4_l4; seq--) {
>  			if (L4_MATCH(iph, uh, seq)) {
> -				if (seq->p.count >= TAP_SEQS)
> +				if (seq->p.count >= UIO_MAXIOV)
>  					seq = NULL;
>  				break;
>  			}
> @@ -840,7 +840,7 @@ resume:
>  	} while (0)
>  
>  		if (seq && L4_MATCH(ip6h, proto, uh, seq) &&
> -		    seq->p.count < TAP_SEQS)
> +		    seq->p.count < UIO_MAXIOV)
>  			goto append;
>  
>  		if (seq_count == TAP_SEQS)
> @@ -848,7 +848,7 @@ resume:
>  
>  		for (seq = tap6_l4 + seq_count - 1; seq >= tap6_l4; seq--) {
>  			if (L4_MATCH(ip6h, proto, uh, seq)) {
> -				if (seq->p.count >= TAP_SEQS)
> +				if (seq->p.count >= UIO_MAXIOV)
>  					seq = NULL;
>  				break;
>  			}

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-08-09  9:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09  9:23 [PATCH] tap: fix seq->p.count limit Laurent Vivier
2023-08-09  9:54 ` David Gibson [this message]
2023-08-09 15:44 ` Laurent Vivier
2023-08-13 13:17 ` Stefano Brivio
2023-08-13 16:31   ` Stefano Brivio

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=ZNNicrdG2jC7J22z@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).