Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3899921rwj; Tue, 20 Dec 2022 03:33:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf7GJzGQAzRksEduFrSjUXtvDx0iY9EbVUl1BrVM1bIs8z9uTL0jrJaXc7hlHoVBo8LkQMTX X-Received: by 2002:a17:906:b091:b0:7ae:bfec:74c7 with SMTP id x17-20020a170906b09100b007aebfec74c7mr38887100ejy.72.1671536033899; Tue, 20 Dec 2022 03:33:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671536033; cv=none; d=google.com; s=arc-20160816; b=o/xGzgCWqRyhI8KeYQcmumXIR+ayA/SGC1XMoEoa0DLeZrtW9Se/diFUPkyl5piiN7 MZm7xnf9Tza14ir+KOqV0+2SN00Kl/n4o/K/U36iKZ/TmhnBC68UrdhwMR1h5pxzCdI5 fAiDnaSlFubwhxZD5GBQ5E4zPpKkpsYplZZdEhsX2xnjxZCMttQEOBaRxRpvdcYfUTVm l7MoW8EPYgqn7C3/CdVakOciG1iCLK9qGS0dUkaMtMZ4GSL/tZcQbY//5Zy18XGaNa5y LDVnSw9FlaJvFQneBGz8KE1iN5xrpv3n4ueCVijOJHmuHbw6syfhkdHhNCFSrYLgSrRi rCTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=6UrO2j9DEey1G8UqydjmxQqMxVbqAZzAn1bK1fPzhSc=; b=a0WUkrMmAy2ziEjtcpam58LzXEMMf+pvX9RoGkUVmNi4ryBP1hvjd2ujhiYttRs/36 9d5Z+K43t/996sy/S3Z8BFvHLTd4zBlOTXGpC+2VbSvG0qc7x+0D6MS3ZZNnGdHJDkY3 bKsoOlySqetM0uhtB8tBpP+ViCF4WcFeu1neAMLOLP2brhpkeRii79WIRTibMmpRcxrA CNmRCu9n6nmiPl8TYlwNzOtSnyZE4uEoJIzwCySTv+SMzhV1N42HaN0uRjoJZHRD6S+H zWQL5NJ6faTzrSNS4Q4DH0ScV5Ydx+zxTMkJgrJV8Hj+vW6l1WTcO3K9k0tC1TKosA7G bKVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@blackwall-org.20210112.gappssmtp.com header.s=20210112 header.b=Ce84Cz9Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z19-20020a05640240d300b0046adf195723si2372279edb.251.2022.12.20.03.33.37; Tue, 20 Dec 2022 03:33:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@blackwall-org.20210112.gappssmtp.com header.s=20210112 header.b=Ce84Cz9Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233434AbiLTKNW (ORCPT + 70 others); Tue, 20 Dec 2022 05:13:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233708AbiLTKNQ (ORCPT ); Tue, 20 Dec 2022 05:13:16 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84E32AE4F for ; Tue, 20 Dec 2022 02:13:15 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id m19so16756970edj.8 for ; Tue, 20 Dec 2022 02:13:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6UrO2j9DEey1G8UqydjmxQqMxVbqAZzAn1bK1fPzhSc=; b=Ce84Cz9ZMLrEN2Gk2uhhVVozKt2Ab9/SVRJooyCg87u9QWuaXj2DzyRfdtJPOtJ/y1 caxj6AxhZeVQV21Mz7mN99Oe9sUOteH83ZZBnEC1zGQIS+y56hR0g9LEc4yKwfcI876m 8BL/xL0n1Zkpxa4xIK8ntmNbuGmbMqXb6DMKHmlGAeEQ07STXlZkyerrchrhlcAXsq5O fEuxO7r57G7VHe8XV15zLqyUdmuh4l/DQIhRor++mvff2ByfO+/2rKHymzbFOkLs2/RX OyoVx1HDQm1yNO0rfnMdz7pIKj106xQFQo/JrlKIe1Ae9oFkDn+G/SislAwKHyP3092p Ssow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6UrO2j9DEey1G8UqydjmxQqMxVbqAZzAn1bK1fPzhSc=; b=dGgXGcBkjS58JX8q3EX9/u4mBS5JjPoi1XiE/AAMo87UXEdVW/bRBp+02VVNZrXxxO 3SSpiuyhSsTnXtjH0l2z3bLBAkE7Cd3DNRiwF4WmSkqVZ2yVSASQovM2msYFuQ0R+KPq VgjYo68PPL9ZXHu3b/Hrtn9AW9WoZbHwL4wC1XW+kse7kGV99A7rvD7afQsVQo1v/xWe /NWgGc6qUSYEd81ASI0hmw1sOTJd32kWK7338iIcRtV4A0oFlIrKeRgJql+Wi1M7/DvH C1wae2ZEyfmeh64CTIt407DC5f8aEOUWl3GUo74KtWwc5tWxCItbJaEBp6EONTaZHWNk ZjNQ== X-Gm-Message-State: ANoB5plJqQBWo0Rgmyz1y/ti5dV+mFnIXTinN0TAd/oCH8JqSvZ8l27w oW93MGcSPiZ8HFUY4WCp8HptoQ== X-Received: by 2002:a05:6402:3641:b0:462:6d7d:ab09 with SMTP id em1-20020a056402364100b004626d7dab09mr41021775edb.38.1671531193850; Tue, 20 Dec 2022 02:13:13 -0800 (PST) Received: from [192.168.0.161] (79-100-144-200.ip.btc-net.bg. [79.100.144.200]) by smtp.gmail.com with ESMTPSA id n1-20020a05640206c100b0046150ee13besm5360318edy.65.2022.12.20.02.13.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Dec 2022 02:13:13 -0800 (PST) Message-ID: <05d630bf-7fa8-4495-6345-207f133ef746@blackwall.org> Date: Tue, 20 Dec 2022 12:13:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH] net: bridge: mcast: read ngrec once in igmp3/mld2 report Content-Language: en-US To: Joy Gu , bridge@lists.linux-foundation.org Cc: roopa@nvidia.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, joern@purestorage.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20221220024807.36502-1-jgu@purestorage.com> From: Nikolay Aleksandrov In-Reply-To: <20221220024807.36502-1-jgu@purestorage.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/12/2022 04:48, Joy Gu wrote: > In br_ip4_multicast_igmp3_report() and br_ip6_multicast_mld2_report(), > "ih" or "mld2r" is a pointer into the skb header. It's dereferenced to > get "num", which is used in the for-loop condition that follows. > > Compilers are free to not spend a register on "num" and dereference that > pointer every time "num" would be used, i.e. every loop iteration. Which > would be a bug if pskb_may_pull() (called by ip_mc_may_pull() or > ipv6_mc_may_pull() in the loop body) were to change pointers pointing > into the skb header, e.g. by freeing "skb->head". > > We can avoid this by using READ_ONCE(). > > Suggested-by: Joern Engel > Signed-off-by: Joy Gu > --- > net/bridge/br_multicast.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > I doubt any compiler would do that (partly due to the ntohs()). If you have hit a bug or seen this with some compiler please provide more details, disassembly of the resulting code would be best. Thanks.