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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C78A4C433EF for ; Wed, 13 Apr 2022 06:11:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232529AbiDMGNZ (ORCPT ); Wed, 13 Apr 2022 02:13:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232252AbiDMGNS (ORCPT ); Wed, 13 Apr 2022 02:13:18 -0400 Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87DFB37A03 for ; Tue, 12 Apr 2022 23:10:47 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id DEBE63200953; Wed, 13 Apr 2022 02:10:44 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Wed, 13 Apr 2022 02:10:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1649830244; x= 1649916644; bh=Jmt+YOtDi3H8U74krhGDbZs40tMLJRCUypvQVKK18Cc=; b=B PR+QiDCgYhLQSyNcS8fxik/z9bPZHTzW6fX7H72eFIYe4UkHW4Hipj7lee8E3uvv T4Tl2Yjr3ANw0wVlzetqsyHad0pk6P8DTAG7k6c7EZzEkIoiegBKOsTiXMKq0iEV ko+ytFLZEMdPBrHWXHuTywifv8evyQ8+UIkR8Jk118NmZkIv0p1sqVBHm7EoSpv8 Pn+SgTUwHAAaJ12kC1tWLRf0s3hzh74xPxgonqm6qBqtgJ1+iZfboC8xZyTmwlTW 9+toqA/VDMaaRxYPaxag6julecN/76wAhw1VdV4cf0kpBOzVrhOCLeJvvFDdBnqq dxg9C3QVvZVo23MjvYcrw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudekledguddtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepkfguohcu ufgthhhimhhmvghluceoihguohhstghhsehiughoshgthhdrohhrgheqnecuggftrfgrth htvghrnheptdffkeekfeduffevgeeujeffjefhtefgueeugfevtdeiheduueeukefhudeh leetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepih guohhstghhsehiughoshgthhdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Apr 2022 02:10:43 -0400 (EDT) Date: Wed, 13 Apr 2022 09:10:39 +0300 From: Ido Schimmel To: Petr Machata Cc: netdev@vger.kernel.org, "David S. Miller" , Jakub Kicinski , Ido Schimmel Subject: Re: [PATCH net] rtnetlink: Fix handling of disabled L3 stats in RTM_GETSTATS replies Message-ID: References: <591b58e7623edc3eb66dd1fcfa8c8f133d090974.1649794741.git.petrm@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <591b58e7623edc3eb66dd1fcfa8c8f133d090974.1649794741.git.petrm@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Apr 12, 2022 at 10:25:06PM +0200, Petr Machata wrote: > When L3 stats are disabled, rtnl_offload_xstats_get_size_stats() returns > size of 0, which is supposed to be an indication that the corresponding > attribute should not be emitted. However, instead, the current code > reserves a 0-byte attribute. > > The reason this does not show up as a citation on a kasan kernel is that > netdev_offload_xstats_get(), which is supposed to fill in the data, never > ends up getting called, because rtnl_offload_xstats_get_stats() notices > that the stats are not actually used and skips the call. > > Thus a zero-length IFLA_OFFLOAD_XSTATS_L3_STATS attribute ends up in a > response, confusing the userspace. > > Fix by skipping the L3-stats related block in rtnl_offload_xstats_fill(). > > Fixes: 0e7788fd7622 ("net: rtnetlink: Add UAPI for obtaining L3 offload xstats") > Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel