Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2596810pxb; Tue, 9 Mar 2021 06:32:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcnrf8tB2+nkWXuswpAOj/DExjrCBTsGRh+c+i1BtKbCqtQ0Wmt2sRpAilP8ovZy26o703 X-Received: by 2002:a17:906:5797:: with SMTP id k23mr21161167ejq.515.1615300334013; Tue, 09 Mar 2021 06:32:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615300334; cv=none; d=google.com; s=arc-20160816; b=sz3A36MRfIcHVb82pNu2gt4gRIUBY95yi4lWwWKKVtcwk5PP2k2MeH4T8/kXzQ10bO 5Rmr5Q2mcAe04Z1ADrYsVuzHhmHyxkTGo7PwqS2zM0SF/jG5a/TqJ4xLAnWhEIvTQnPQ MBdSZcGM98L7l4Bny/mCJmoPYe07stSnHjLGxe2VLDGUvkj12YHxV8LsF9EeEoKdMwAe DutL7wYe0LrkbX/Grs9xNR0OZJQlNqrJXcloze4gia5VCvBeM28azVo0wHURvC+c1FM2 uNdj+p7ArdEsnSFMR+w7yxKDS5WRqZCJUciSbC1Tt4gCM3tkL3OBjpHyOTmL3kIhGDdX TxlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=qXQaz6o4atEJRYBV31RTFfL6gXZMWZsubP8sDmVgbZQ=; b=KEhSoIhEZuS+tVPbg5hpyFaDNjY+AY5R4gjhdb8hDPMQEqpQQyDIANxAMACtSAMbot T3V/Vialt4DHFaT00298VHvsmZPl0VfVbY3oaRkY5TkpQfimqZ0Cgd95cgVWX1Wm4ADp IBa5RrsMYlAsm+/gxFRVP6pcvRcsKIEYZS10AjOSeO1Kz4qw67Ka91R1jx5iLPh38EOe z8a0D8Ol7BHHYzUtioSStVigSxFQEEh5uDepudYWP59cNfz8482m8pTXkpKw5ZY43//z I+NgkzhcX2jke9hcHtUyVg/gZdLUuE9AdlQ9Q/nS0WVHFqW31IwrbiC83gaVwGaYQTIN l74Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=au56fHLL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bd18si9039491edb.609.2021.03.09.06.31.50; Tue, 09 Mar 2021 06:32:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=au56fHLL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230490AbhCIOao (ORCPT + 99 others); Tue, 9 Mar 2021 09:30:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230371AbhCIOaO (ORCPT ); Tue, 9 Mar 2021 09:30:14 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B22A7C06174A for ; Tue, 9 Mar 2021 06:30:13 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id x9so20477209edd.0 for ; Tue, 09 Mar 2021 06:30:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qXQaz6o4atEJRYBV31RTFfL6gXZMWZsubP8sDmVgbZQ=; b=au56fHLLqSDZ32svP/xUg7xLMNSde2/I3pHgvCvdQj4Hg4vCaCD6OmBVREF29YOaNk vJjCUz/23fLp5igggCvoWzZdbDJKzB3HCWTEMeQSF+dQw56rXDiY7UROn9tanPEwm/4O aVWGqQXGLpsfaXVuJj8POuaglPiq43KbYP3+rzOIm2NztRnr92M8Z2gQnuodZb9iy66p ylSyGZcZgRAHM72qPOKI9D+x9UcxbWivnI4svzrZraIVaEbebcQOjcD59L3w+NIq7FVS eboqFRffwc7ovjPZ0xWW6ogtUiYUwM95YkLDrK4TJyeot+r2cLyCDd5GegD5FEvUVfsk mUMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qXQaz6o4atEJRYBV31RTFfL6gXZMWZsubP8sDmVgbZQ=; b=DnXVptNUmp/Sf3DS+rVbP6f8r0KXGMkYAA/3rEniVtH31+K3HnENm4BTr/24LpaFA8 szZxcmOyHwEALXl2gGk1BLQSEJKctDb6dBjU4kCBHsVjpP+fGTA6SIyDUJzSfV0eCLmi cZJlBbEGv8EhWIWTpk2ZfK++rLji2P3HjQ3/2zKs35n9B+JBRw6KXIqDnPPn2//w+/i7 SBKNrk33Lrg5j7dr44jjcYngk3jvzxJ39WtEdcwQnPXTIdOrteHy6UNTH/m7Z77sKXQ7 yEotvX5A62EfZT/JyWAoQiBqJ6fY2S2CVjDz7t3kjbwbonP/dYUETcS5O4n9XjdaLeRv loFQ== X-Gm-Message-State: AOAM5309qx9dgj0TfvqzLTPwKWvpllYFDgVuM/Q4rWjiaXLDPkjom3t2 LymQNZ6GYijHEbvtNYIE0ZESLNQmzH4= X-Received: by 2002:a50:ed90:: with SMTP id h16mr4420101edr.101.1615300212028; Tue, 09 Mar 2021 06:30:12 -0800 (PST) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com. [209.85.221.53]) by smtp.gmail.com with ESMTPSA id gj13sm8064140ejb.118.2021.03.09.06.30.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Mar 2021 06:30:11 -0800 (PST) Received: by mail-wr1-f53.google.com with SMTP id 7so16040232wrz.0 for ; Tue, 09 Mar 2021 06:30:11 -0800 (PST) X-Received: by 2002:a5d:6cab:: with SMTP id a11mr28646938wra.419.1615300210948; Tue, 09 Mar 2021 06:30:10 -0800 (PST) MIME-Version: 1.0 References: <9b79f43d2dfec8b2cb8e896b5591e7b1c3cc1f6c.1615288658.git.bnemeth@redhat.com> In-Reply-To: <9b79f43d2dfec8b2cb8e896b5591e7b1c3cc1f6c.1615288658.git.bnemeth@redhat.com> From: Willem de Bruijn Date: Tue, 9 Mar 2021 09:29:31 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH net v3 2/2] net: avoid infinite loop in mpls_gso_segment when mpls_hlen == 0 To: Balazs Nemeth Cc: Network Development , linux-kernel , "Michael S. Tsirkin" , Jason Wang , David Ahern , David Miller , virtualization@lists.linux-foundation.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 9, 2021 at 6:32 AM Balazs Nemeth wrote: > > A packet with skb_inner_network_header(skb) == skb_network_header(skb) > and ETH_P_MPLS_UC will prevent mpls_gso_segment from pulling any headers > from the packet. Subsequently, the call to skb_mac_gso_segment will > again call mpls_gso_segment with the same packet leading to an infinite > loop. In addition, ensure that the header length is a multiple of four, > which should hold irrespective of the number of stacked labels. > > Signed-off-by: Balazs Nemeth Acked-by: Willem de Bruijn The compiler will convert that modulo into a cheap & (ETH_HLEN - 1) test for this constant.