diff mbox series

[ovs-dev,v2,1/4] dp-packet: Validate correct offset for L4 inner size.

Message ID 20240130221439.24297-1-mkp@redhat.com
State Changes Requested
Headers show
Series [ovs-dev,v2,1/4] dp-packet: Validate correct offset for L4 inner size. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/intel-ovs-compilation success test: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Mike Pattrick Jan. 30, 2024, 10:14 p.m. UTC
This patch fixes the correctness of dp_packet_inner_l4_size() when
checking for the existence of an inner L4 header. Previously it checked
for the outer L4 header.

This function is currently only used when a packet is already flagged
for tunneling, so an incorrect determination isn't possible as long as
the flags of the packet are correct.

Fixes: 85bcbbed839a ("userspace: Enable tunnel tests with TSO.")
Signed-off-by: Mike Pattrick <mkp@redhat.com>
---
v2: Corrected patch subject
---
 lib/dp-packet.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Marchand Jan. 31, 2024, 2:43 p.m. UTC | #1
On Tue, Jan 30, 2024 at 11:15 PM Mike Pattrick <mkp@redhat.com> wrote:
>
> This patch fixes the correctness of dp_packet_inner_l4_size() when
> checking for the existence of an inner L4 header. Previously it checked
> for the outer L4 header.
>
> This function is currently only used when a packet is already flagged
> for tunneling, so an incorrect determination isn't possible as long as
> the flags of the packet are correct.
>
> Fixes: 85bcbbed839a ("userspace: Enable tunnel tests with TSO.")
> Signed-off-by: Mike Pattrick <mkp@redhat.com>

Reviewed-by: David Marchand <david.marchand@redhat.com>
Ilya Maximets Feb. 6, 2024, 12:53 p.m. UTC | #2
On 1/30/24 23:14, Mike Pattrick wrote:
> This patch fixes the correctness of dp_packet_inner_l4_size() when
> checking for the existence of an inner L4 header. Previously it checked
> for the outer L4 header.
> 
> This function is currently only used when a packet is already flagged
> for tunneling, so an incorrect determination isn't possible as long as
> the flags of the packet are correct.
> 
> Fixes: 85bcbbed839a ("userspace: Enable tunnel tests with TSO.")
> Signed-off-by: Mike Pattrick <mkp@redhat.com>
> ---
> v2: Corrected patch subject
> ---
>  lib/dp-packet.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/dp-packet.h b/lib/dp-packet.h
> index dceb701e8..802d3f385 100644
> --- a/lib/dp-packet.h
> +++ b/lib/dp-packet.h
> @@ -540,7 +540,7 @@ dp_packet_inner_l4(const struct dp_packet *b)
>  static inline size_t
>  dp_packet_inner_l4_size(const struct dp_packet *b)
>  {
> -    return OVS_LIKELY(b->l4_ofs != UINT16_MAX)
> +    return OVS_LIKELY(b->inner_l4_ofs != UINT16_MAX)
>             ? (const char *) dp_packet_tail(b)
>             - (const char *) dp_packet_inner_l4(b)
>             - dp_packet_l2_pad_size(b)

Hi, Mike.  Thanks for v2!

I don't have any particular comments beside the ones David already made.
Could you, please, address them and post a new version?

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/dp-packet.h b/lib/dp-packet.h
index dceb701e8..802d3f385 100644
--- a/lib/dp-packet.h
+++ b/lib/dp-packet.h
@@ -540,7 +540,7 @@  dp_packet_inner_l4(const struct dp_packet *b)
 static inline size_t
 dp_packet_inner_l4_size(const struct dp_packet *b)
 {
-    return OVS_LIKELY(b->l4_ofs != UINT16_MAX)
+    return OVS_LIKELY(b->inner_l4_ofs != UINT16_MAX)
            ? (const char *) dp_packet_tail(b)
            - (const char *) dp_packet_inner_l4(b)
            - dp_packet_l2_pad_size(b)