Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp889434pxb; Wed, 6 Apr 2022 03:20:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRlKkBeHBkERSAfwFHRiBnqK8BEyLeOpS8hmWQMnJl3HbGO4hHCEVD9Z3Fa9PEqp0CoPpK X-Received: by 2002:a05:6a00:24c5:b0:4fa:f63a:4c3 with SMTP id d5-20020a056a0024c500b004faf63a04c3mr8092683pfv.15.1649240444445; Wed, 06 Apr 2022 03:20:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649240444; cv=none; d=google.com; s=arc-20160816; b=b6diA40LkMrlpY17GI0/OGj4DWvA+KOl40yfDQ8uY4ULEzZG9FGggf8RnddZBAukuj 37161u0HO2uX1qHv+yFdBcsc4+eLhsZRgdBF8FLuWLOsoA3CUD82k4NmR4vFrlg+kYgi XS5sF7mMWcItYq3YRLV4eBUjM7w3usdOaHsRs3Yl4nn/QVrDUZRGpV2lF2hXvpLZLLDp FJSbJxfE3WXTOrHyGG2oZvRSCpHZHXGLE/1yE+Hhs6/tHxplsP4PkIURtwJ90agWn5q1 NP5m5wJWT9uILbv7/XCyB7awZH15utf9vy7bMnpOrVoUQPlvUHptisunedqNsQuXp+Ki 7MLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4eKJG68ZtowDVxETmlMVZgKU9CpxIv4hKMis0pW1Zk8=; b=vl4bHBD2n24TzAOiJqsw/E7dYgcNPJ3QXLo+i7NoCnPZWGcEV423aUZPGzlk0e8y7U zR+tbfuGDHUo/y+BKSxYjngHYvsqaBCZ+jb9jKGzL9I6L7DGY+H+icn72N8IFgM8v+Cg n+lxHPZEcub2FtWzv7ksHGTHFYtcmqZL2bIZ9MBMVdWbWuN+gnAaYUn12WFVnHCyW2qT EZ5N5R/I4wVYTP/X/f0QmopXZi9naPXsB8XEguKMM2oNeT2XikRWnbPE0vYS0BCv+HGE y2K90e0loNTnlOfVd6h+fCO75/fYh7tq2vkgz6RKa98lcHC0QqSzBmHYyEOE3U0fSVoN 505w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x5buKPgA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e21-20020a635455000000b00382174dc566si15581672pgm.54.2022.04.06.03.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 03:20:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x5buKPgA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BC7DC4B63E8; Wed, 6 Apr 2022 01:43:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1455075AbiDEWkG (ORCPT + 99 others); Tue, 5 Apr 2022 18:40:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348968AbiDEJsu (ORCPT ); Tue, 5 Apr 2022 05:48:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7D9DA27E1; Tue, 5 Apr 2022 02:38:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5335261576; Tue, 5 Apr 2022 09:38:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C3B2C385A3; Tue, 5 Apr 2022 09:38:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151504; bh=QgN7lXd/5D4nXDbVFwp/TInBYA77pHrREhhUm7GLROU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x5buKPgAt5L6YpFN6h/0l1m7pt3x9UOJ38bmxyPbYEtx0e692u738G81sUzqDrqSd Gq/ed79QbFJ/ugMipTiCvSyHecP5yLrzfO3bGxPtosw6a1DiepQEpDdaU1lCcvxdpZ QWbh1HOIVmxm6An09NNZCsmA6sIpQzx8o+7+Ynq8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lennert Buytenhek , Corinna Vinschen , Vinicius Costa Gomes , Dvora Fuxbrumer , Tony Nguyen , Sasha Levin Subject: [PATCH 5.15 439/913] igc: avoid kernel warning when changing RX ring parameters Date: Tue, 5 Apr 2022 09:25:01 +0200 Message-Id: <20220405070353.004872616@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Corinna Vinschen [ Upstream commit 453307b569a0d41bddd07f26bf41b784cd82a4c9 ] Calling ethtool changing the RX ring parameters like this: $ ethtool -G eth0 rx 1024 on igc triggers kernel warnings like this: [ 225.198467] ------------[ cut here ]------------ [ 225.198473] Missing unregister, handled but fix driver [ 225.198485] WARNING: CPU: 7 PID: 959 at net/core/xdp.c:168 xdp_rxq_info_reg+0x79/0xd0 [...] [ 225.198601] Call Trace: [ 225.198604] [ 225.198609] igc_setup_rx_resources+0x3f/0xe0 [igc] [ 225.198617] igc_ethtool_set_ringparam+0x30e/0x450 [igc] [ 225.198626] ethnl_set_rings+0x18a/0x250 [ 225.198631] genl_family_rcv_msg_doit+0xca/0x110 [ 225.198637] genl_rcv_msg+0xce/0x1c0 [ 225.198640] ? rings_prepare_data+0x60/0x60 [ 225.198644] ? genl_get_cmd+0xd0/0xd0 [ 225.198647] netlink_rcv_skb+0x4e/0xf0 [ 225.198652] genl_rcv+0x24/0x40 [ 225.198655] netlink_unicast+0x20e/0x330 [ 225.198659] netlink_sendmsg+0x23f/0x480 [ 225.198663] sock_sendmsg+0x5b/0x60 [ 225.198667] __sys_sendto+0xf0/0x160 [ 225.198671] ? handle_mm_fault+0xb2/0x280 [ 225.198676] ? do_user_addr_fault+0x1eb/0x690 [ 225.198680] __x64_sys_sendto+0x20/0x30 [ 225.198683] do_syscall_64+0x38/0x90 [ 225.198687] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 225.198693] RIP: 0033:0x7f7ae38ac3aa igc_ethtool_set_ringparam() copies the igc_ring structure but neglects to reset the xdp_rxq_info member before calling igc_setup_rx_resources(). This in turn calls xdp_rxq_info_reg() with an already registered xdp_rxq_info. Make sure to unregister the xdp_rxq_info structure first in igc_setup_rx_resources. Fixes: 73f1071c1d29 ("igc: Add support for XDP_TX action") Reported-by: Lennert Buytenhek Signed-off-by: Corinna Vinschen Acked-by: Vinicius Costa Gomes Tested-by: Dvora Fuxbrumer Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/igc/igc_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index a514cfc6c8a0..f99819fc559d 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -504,6 +504,9 @@ int igc_setup_rx_resources(struct igc_ring *rx_ring) u8 index = rx_ring->queue_index; int size, desc_len, res; + /* XDP RX-queue info */ + if (xdp_rxq_info_is_reg(&rx_ring->xdp_rxq)) + xdp_rxq_info_unreg(&rx_ring->xdp_rxq); res = xdp_rxq_info_reg(&rx_ring->xdp_rxq, ndev, index, rx_ring->q_vector->napi.napi_id); if (res < 0) { -- 2.34.1