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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D93FC52D6F for ; Tue, 27 Aug 2024 08:38:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1QUY99BQnRe9MEXDdHrO9LU1xOLBc9OegOD6TyQWubM=; b=o/yjWXL4POJVOoaHNa/PUgOpX2 a1nedaIRYlmVgnGeZ11bqfU34IICr/TvHc3pYjH04+v9bj2x/Ov0LPcckNPDUPNfHUP+f/9IXz9JH 9zFlLm+z+eFEer8vReY5Fg+3q4tFcoiiyNJAAu9sXvtK1kMOUTMGsE+EbaN4OtgEr3pGRup9x8XKM lUxmBmzeTUPY5o5FDSLWKM33F7uNU00N8p28cHrVpXUwcwhhZaPseBBZoEL7e/AaKnwZRr3+Rw93O eMiKhgZjUU9X8xhDHeMpM1Oh7Dvu6f7VTIb6BT9U7glJj8JI7Ntcy6fujUN0hKr8lHocIBHEVawQ4 iMHdwjBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sirif-0000000AQbu-41Ox; Tue, 27 Aug 2024 08:38:29 +0000 Received: from relay7-d.mail.gandi.net ([217.70.183.200]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sirhr-0000000AQQ8-03Go for linux-arm-kernel@lists.infradead.org; Tue, 27 Aug 2024 08:37:41 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 612D02000B; Tue, 27 Aug 2024 08:37:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1724747856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1QUY99BQnRe9MEXDdHrO9LU1xOLBc9OegOD6TyQWubM=; b=mJVqTFzYXycsoLCe+NUIJgC4yILgvNqq9PToTnxwc5V3/fgp1p2JUuupgmI1ly9k5+eHH/ ZipB99yIq7m+Crlu705p/926mn7yIny7fO2ncfm4cD0I8K5PjmL7shxhfdTtLUnCqBmosg SSLUmk8//WADlpVMIpOHSOFyxOoUPMFeb0PUiratCNYhx8xA/32Bg4b1xOOOFLQf5BRMWu wq4ErU7HpDKdR5MyKG2t5m6rHJWJwI75A2R2dd7Xp/BP5+WDA4Z80iUNAuUiodv+w1rQlf KmA3LuAVyPKxWilCEPiB+mG7lXlb8lE9PnANDHcuIOJx29b+Gx6g64qFP0N5rw== Date: Tue, 27 Aug 2024 10:37:32 +0200 From: Maxime Chevallier To: Dan Carpenter Cc: Pengfei Xu , davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?UTF-8?B?S8O2cnk=?= Maincent , Jesse Brandeburg , Marek =?UTF-8?B?QmVow7pu?= , Piergiorgio Beruto , Oleksij Rempel , =?UTF-8?B?Tmljb2zDsg==?= Veronese , Simon Horman , mwojtas@chromium.org, Nathan Chancellor , Antoine Tenart , Marc Kleine-Budde , Romain Gantois Subject: Re: [PATCH net-next v17 11/14] net: ethtool: cable-test: Target the command to the requested PHY Message-ID: <20240827103732.690fb31d@fedora-3.home> In-Reply-To: References: <20240709063039.2909536-1-maxime.chevallier@bootlin.com> <20240709063039.2909536-12-maxime.chevallier@bootlin.com> <20240827073359.5d47c077@fedora-3.home> Organization: Bootlin X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-GND-Sasl: maxime.chevallier@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240827_013739_678366_11B8C427 X-CRM114-Status: GOOD ( 16.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Dan, On Tue, 27 Aug 2024 11:27:48 +0300 Dan Carpenter wrote: > On Tue, Aug 27, 2024 at 07:33:59AM +0200, Maxime Chevallier wrote: > > > > This issue has indeed been detected, and is being addressed, see : > > > > https://lore.kernel.org/netdev/20240826134656.94892-1-djahchankoike@gmail.com/ > > > > There is a similar bug in ethnl_act_cable_test_tdr() that needs to be fixed > as well. > > net/ethtool/cabletest.c > 307 int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info) > 308 { > 309 struct ethnl_req_info req_info = {}; > 310 const struct ethtool_phy_ops *ops; > 311 struct nlattr **tb = info->attrs; > 312 struct phy_device *phydev; > 313 struct phy_tdr_config cfg; > 314 struct net_device *dev; > 315 int ret; > 316 > 317 ret = ethnl_parse_header_dev_get(&req_info, > 318 tb[ETHTOOL_A_CABLE_TEST_TDR_HEADER], > 319 genl_info_net(info), info->extack, > 320 true); > 321 if (ret < 0) > 322 return ret; > 323 > 324 dev = req_info.dev; > 325 > 326 ret = ethnl_act_cable_test_tdr_cfg(tb[ETHTOOL_A_CABLE_TEST_TDR_CFG], > 327 info, &cfg); > 328 if (ret) > 329 goto out_dev_put; > 330 > 331 rtnl_lock(); > ^^^^^^^^^^^^ > > 332 phydev = ethnl_req_get_phydev(&req_info, > 333 tb[ETHTOOL_A_CABLE_TEST_TDR_HEADER], > 334 info->extack); > 335 if (!IS_ERR_OR_NULL(phydev)) { > ^ > This test is reversed so it will lead to a crash. > > Could you add some comments to ethnl_req_get_phydev() what the NULL return > means vs the error pointers? I figured it out because the callers have comments > but it should be next to ethnl_req_get_phydev() as well. Good catch ! I'll send some followup to address this report as well as update the doc. Thanks, Maxime