From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75F19C48BD6 for ; Wed, 26 Jun 2019 00:05:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 47FDA20883 for ; Wed, 26 Jun 2019 00:05:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="n9y6cStZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726401AbfFZAFs (ORCPT ); Tue, 25 Jun 2019 20:05:48 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:44528 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725782AbfFZAFr (ORCPT ); Tue, 25 Jun 2019 20:05:47 -0400 Received: by mail-pf1-f193.google.com with SMTP id t16so245373pfe.11 for ; Tue, 25 Jun 2019 17:05:47 -0700 (PDT) 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=j+XcJIMVM4uEkav1jYKM8jg1O0IYdyLWsof36nok6Kg=; b=n9y6cStZ7/BACW9n1RkJ/Pbjw/mm2bLY29FV70FGx8RR71wNZY4SgdO4a86caX4zxd mQW+Rk3SE/V7RGtYpxt9jI5YpS0M9m3NlWC4siuDbdEQDlLYbFbPsrB0VgFm0wDAsvRW yIFktOrEgHRzxvkTN2p0MM1R/gakIsNM2SEOCSmzbTPfW8B3fMMp009Cr3ATUI/M6Cd0 Y4iS4trWeS3lMGVAPCaGoXhgv9kCUp5mVw1ImU2lJG4DE8r+Ow62xmoHGogat/B6dn9y usdHsPGbb4kqoSxlHcPY2COFqxzBKorEL10+R6Fr3FK6xNPLDzaDOk2ufLPECtTzFliZ 4hWQ== 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=j+XcJIMVM4uEkav1jYKM8jg1O0IYdyLWsof36nok6Kg=; b=cfapleJ2/VdDFt3kEVJgHtR2wcwHPe2+xCMa9jDxAX0phJk38XbCJSlqRvaScxgmLc bE4OKDYFst0OdpxtTmQaGKGFJMAL/1aG5p/kGZyLqIeK0M8Hg5uW5RIk9oVAXSeibYdD sOI3dLUgJ0xaGmJRSP+ADCJXD+hWSg5JhZ0fXMkavjmnwbLC50yumgh4PDKL5GDladmP s6gjr0fgyzaYVePfBELGUSZwLAaONwviFuRMwVjZVwc/x6SYPPUyQZtJzh4yEKQzoBJb PzFZTlpFUCW7rSqwGJJrCZTxfwaMhqkj3T93qeV6mcga4YXtjMGY7XO/IUlti2CCnHSB aQOw== X-Gm-Message-State: APjAAAXnSuxSHykkthNucEYGrTyj0dL9BRBDiKyfKW6MQwXlJDfrS65+ YxkAfQaF4eM2e3T2tXcBpgl2dyCEdqLxb3oaIPk= X-Google-Smtp-Source: APXvYqwm5HRbPxxdHKlTlvSzZGP5cU118CHcWjSt3kF6wsiQKJa3iQK3xQXMpkoLCjwHXr/2H28fuTmwUk18mlgyzJk= X-Received: by 2002:a63:fa4e:: with SMTP id g14mr41437706pgk.237.1561507546991; Tue, 25 Jun 2019 17:05:46 -0700 (PDT) MIME-Version: 1.0 References: <9068475730862e1d9014c16cee0ad2734a4dd1f9.1560978242.git.dcaratti@redhat.com> <53b8c3118900b31536594e98952640c03a4456e0.camel@redhat.com> <6650f0da68982ffa5bb71a773c5a3d588bd972c4.camel@redhat.com> In-Reply-To: From: Cong Wang Date: Tue, 25 Jun 2019 17:05:34 -0700 Message-ID: Subject: Re: [PATCH net] net/sched: flower: fix infinite loop in fl_walk() To: Davide Caratti Cc: Vlad Buslov , "David S. Miller" , Linux Kernel Network Developers , Lucas Bates Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Jun 25, 2019 at 12:29 PM Cong Wang wrote: > > On Tue, Jun 25, 2019 at 11:07 AM Cong Wang wrote: > > On one hand, its callers should not need to worry about details > > like overflow. On the other hand, in fact it does exactly what its > > callers tell it to do, the problematic part is actually the > > incremented id. On 64bit, it is fairly easy, we can just simply > > know 'long' is longer than 32bit and leverage this to detect overflow, > > but on 32bit this clearly doesn't work. > > > > Let me think about it. > > Davide, do you mind to try the attached patch? > > It should handle this overflow case more gracefully, I hope. Well, it looks like it would miss UINT_MAX... Let me see how this can be fixed.