All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aaron Conole <aconole@redhat.com>
To: Faicker Mo <faicker.mo@zenlayer.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"dev@openvswitch.org" <dev@openvswitch.org>,
	 "echaudro@redhat.com" <echaudro@redhat.com>,
	 "i.maximets@ovn.org" <i.maximets@ovn.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	 "edumazet@google.com" <edumazet@google.com>,
	 "kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	 "horms@kernel.org" <horms@kernel.org>,
	 "martin.varghese@nokia.com" <martin.varghese@nokia.com>,
	 "pshelar@ovn.org" <pshelar@ovn.org>
Subject: Re: [PATCH net-next v3] net: openvswitch: Fix the dead loop of MPLS parse
Date: Thu, 22 May 2025 12:27:08 -0400	[thread overview]
Message-ID: <f7ty0uod31f.fsf@redhat.com> (raw)
In-Reply-To: <21855B7D-A3D5-4031-A618-CCA8FD75B6FD@zenlayer.com> (Faicker Mo's message of "Thu, 22 May 2025 07:49:08 +0000")

Hi Faicker,

Faicker Mo <faicker.mo@zenlayer.com> writes:

> The unexpected MPLS packet may not end with the bottom label stack.
> When there are many stacks, The label count value has wrapped around.
> A dead loop occurs, soft lockup/CPU stuck finally.
>
> stack backtrace:
> UBSAN: array-index-out-of-bounds in /build/linux-0Pa0xK/linux-5.15.0/net/openvswitch/flow.c:662:26
> index -1 is out of range for type '__be32 [3]'
> CPU: 34 PID: 0 Comm: swapper/34 Kdump: loaded Tainted: G           OE   5.15.0-121-generic #131-Ubuntu
> Hardware name: Dell Inc. PowerEdge C6420/0JP9TF, BIOS 2.12.2 07/14/2021
> Call Trace:
> <IRQ>
> show_stack+0x52/0x5c
> dump_stack_lvl+0x4a/0x63
> dump_stack+0x10/0x16
> ubsan_epilogue+0x9/0x36
> __ubsan_handle_out_of_bounds.cold+0x44/0x49
> key_extract_l3l4+0x82a/0x840 [openvswitch]
> ? kfree_skbmem+0x52/0xa0
> key_extract+0x9c/0x2b0 [openvswitch]
> ovs_flow_key_extract+0x124/0x350 [openvswitch]
> ovs_vport_receive+0x61/0xd0 [openvswitch]
> ? kernel_init_free_pages.part.0+0x4a/0x70
> ? get_page_from_freelist+0x353/0x540
> netdev_port_receive+0xc4/0x180 [openvswitch]
> ? netdev_port_receive+0x180/0x180 [openvswitch]
> netdev_frame_hook+0x1f/0x40 [openvswitch]
> __netif_receive_skb_core.constprop.0+0x23a/0xf00
> __netif_receive_skb_list_core+0xfa/0x240
> netif_receive_skb_list_internal+0x18e/0x2a0
> napi_complete_done+0x7a/0x1c0
> bnxt_poll+0x155/0x1c0 [bnxt_en]
> __napi_poll+0x30/0x180
> net_rx_action+0x126/0x280
> ? bnxt_msix+0x67/0x80 [bnxt_en]
> handle_softirqs+0xda/0x2d0
> irq_exit_rcu+0x96/0xc0
> common_interrupt+0x8e/0xa0
> </IRQ>
>
> Fixes: fbdcdd78da7c ("Change in Openvswitch to support MPLS label depth of 3 in ingress direction")

This tells me it should go to 'net' rather than 'net-next', so your
subject should look like:

  [PATCH net v4] net: openvswitch: Fix the dead loop of MPLS parse

> Signed-off-by: Faicker Mo <faicker.mo@zenlayer.com>
> ---
> v2
> - Changed return value based on Eelco's feedback.
> - Added Fixes.
> v3
> - Revert "Changed return value based on Eelco's feedback".
> - Changed the label_count variable type based on Ilya's feedback.


Somehow, this patch is still getting corrupted.  For example, it is
missing the leading ' ' character in the diffs.  This is one reason
the patch fails to apply.

> ---
> net/openvswitch/flow.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
> index 8a848ce72e29..b80bd3a90773 100644
> --- a/net/openvswitch/flow.c
> +++ b/net/openvswitch/flow.c
> @@ -788,7 +788,7 @@ static int key_extract_l3l4(struct sk_buff *skb, struct sw_flow_key *key)
> 			memset(&key->ipv4, 0, sizeof(key->ipv4));
> 		}
> 	} else if (eth_p_mpls(key->eth.type)) {
> -		u8 label_count = 1;
> +		size_t label_count = 1;

This change looks good to me.

>
> 		memset(&key->mpls, 0, sizeof(key->mpls));
> 		skb_set_inner_network_header(skb, skb->mac_len);
> --
> 2.34.1


      reply	other threads:[~2025-05-22 16:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-22  7:49 [PATCH net-next v3] net: openvswitch: Fix the dead loop of MPLS parse Faicker Mo
2025-05-22 16:27 ` Aaron Conole [this message]

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=f7ty0uod31f.fsf@redhat.com \
    --to=aconole@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dev@openvswitch.org \
    --cc=echaudro@redhat.com \
    --cc=edumazet@google.com \
    --cc=faicker.mo@zenlayer.com \
    --cc=horms@kernel.org \
    --cc=i.maximets@ovn.org \
    --cc=kuba@kernel.org \
    --cc=martin.varghese@nokia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pshelar@ovn.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.