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=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 AC173C3A5A3 for ; Tue, 27 Aug 2019 09:50:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B27D20828 for ; Tue, 27 Aug 2019 09:50:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729523AbfH0Juj (ORCPT ); Tue, 27 Aug 2019 05:50:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47246 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728178AbfH0Juj (ORCPT ); Tue, 27 Aug 2019 05:50:39 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6285D308218D; Tue, 27 Aug 2019 09:50:39 +0000 (UTC) Received: from localhost (ovpn-112-31.ams2.redhat.com [10.36.112.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D4F925D9C3; Tue, 27 Aug 2019 09:50:35 +0000 (UTC) Date: Tue, 27 Aug 2019 11:50:31 +0200 From: Stefano Brivio To: Davide Caratti Cc: Cong Wang , Jamal Hadi Salim , Jiri Pirko , "David S. Miller" , netdev@vger.kernel.org, Paolo Abeni , Li Shuang Subject: Re: [PATCH net] net/sched: pfifo_fast: fix wrong dereference when qdisc is reset Message-ID: <20190827115031.43fcbac5@redhat.com> In-Reply-To: <0598164c6e32684e57c7656f0b8aca0813c51f42.1566861256.git.dcaratti@redhat.com> References: <0598164c6e32684e57c7656f0b8aca0813c51f42.1566861256.git.dcaratti@redhat.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 27 Aug 2019 09:50:39 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, 27 Aug 2019 01:15:16 +0200 Davide Caratti wrote: > diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c > index 11c03cf4aa74..c89b787785a1 100644 > --- a/net/sched/sch_generic.c > +++ b/net/sched/sch_generic.c > @@ -688,12 +688,14 @@ static void pfifo_fast_reset(struct Qdisc *qdisc) > kfree_skb(skb); > } > > - for_each_possible_cpu(i) { > - struct gnet_stats_queue *q = per_cpu_ptr(qdisc->cpu_qstats, i); > + if (qdisc_is_percpu_stats(qdisc)) This needs curly brackets, as the block has multiple lines (for coding style only). > + for_each_possible_cpu(i) { > + struct gnet_stats_queue *q = > + per_cpu_ptr(qdisc->cpu_qstats, i); And you could split declaration and assignment here, it takes two lines anyway and becomes more readable. -- Stefano