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.8 required=3.0 tests=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 A1FF7C48BD5 for ; Tue, 25 Jun 2019 16:23:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 709C1208E3 for ; Tue, 25 Jun 2019 16:23:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727898AbfFYQXn (ORCPT ); Tue, 25 Jun 2019 12:23:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11247 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726740AbfFYQXn (ORCPT ); Tue, 25 Jun 2019 12:23:43 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ECFF1316291C; Tue, 25 Jun 2019 16:23:42 +0000 (UTC) Received: from localhost.localdomain (unknown [10.32.181.77]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFF781001281; Tue, 25 Jun 2019 16:23:39 +0000 (UTC) Message-ID: <0e1075c74d5c71acd9fbbc5ad76c07cc158324f2.camel@redhat.com> Subject: Re: [PATCH net] net/sched: flower: fix infinite loop in fl_walk() From: Davide Caratti To: Cong Wang Cc: Vlad Buslov , "David S. Miller" , Linux Kernel Network Developers , Lucas Bates In-Reply-To: <6650f0da68982ffa5bb71a773c5a3d588bd972c4.camel@redhat.com> References: <9068475730862e1d9014c16cee0ad2734a4dd1f9.1560978242.git.dcaratti@redhat.com> <53b8c3118900b31536594e98952640c03a4456e0.camel@redhat.com> <6650f0da68982ffa5bb71a773c5a3d588bd972c4.camel@redhat.com> Organization: red hat Content-Type: text/plain; charset="UTF-8" Date: Tue, 25 Jun 2019 18:23:38 +0200 Mime-Version: 1.0 User-Agent: Evolution 3.30.3 (3.30.3-1.fc29) Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 25 Jun 2019 16:23:43 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, 2019-06-25 at 17:47 +0200, Davide Caratti wrote: > On Thu, 2019-06-20 at 10:33 -0700, Cong Wang wrote: > > On Thu, Jun 20, 2019 at 5:52 AM Davide Caratti wrote: > > > hello Cong, thanks for reading. > > > > > > On Wed, 2019-06-19 at 15:04 -0700, Cong Wang wrote: > > > > On Wed, Jun 19, 2019 at 2:10 PM Davide Caratti wrote: > > > > > on some CPUs (e.g. i686), tcf_walker.cookie has the same size as the IDR. > > > > > In this situation, the following script: > > > > > > > > > > # tc filter add dev eth0 ingress handle 0xffffffff flower action ok > > > > > # tc filter show dev eth0 ingress > > > > > > > > > > results in an infinite loop. > > So, when the radix tree contains one slot with index equal to ULONG_MAX, > whatever can be the value of 'id', oops, this phrase is of course wrong. the value of 'id' matters to determine the condition of the if(). > the condition in that if() will always > be false (and the function will keep returning non-NULL, hence the > infinite loop). what I wanted to say is, when the radix tree contains a single slot with index equal to ULONG_MAX, whatever value I put in 'id' the function will always return a pointer to that slot. -- davide