From nobody Tue Sep 29 13:20:38 2026 Received: from canpmsgout06.his.huawei.com (canpmsgout06.his.huawei.com [113.46.200.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F6153F6C21; Fri, 7 Aug 2026 09:55:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.221 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786096509; cv=none; b=NwrWKM9D7YgnmqmvXcJYSd6R1BDKloedoxcOyMHRnHfRcUxSETuDYe0ldXm19ac+MCHOE46W0epcUJqEN4abKYEMwe4QUL8bodazCQEXjz9SLcVqfbj7KK/fVvcRbzzKr8yzIarOTBL6c92MyHD/TfzFbKHuw4RxRWL5ktzFySw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786096509; c=relaxed/simple; bh=Yp7Gql3Z4eZVk1KGaP8S0bv+Z80EHQo7rMzpnKohQrc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=udO3ukRzlHPAIv9PnS/4ZLMwKulwBKYJfy4Zbo3Ssrej+7R7lnenPvppPzuBDGQpWUZlOb8a7TpRFa3j4WSaUnRhe/PjBsdAjgOoSeW2fusO66GvgXrluq0nxXVgrmmUIr8AxQv0XWf3hnhK2/33559rVcHUy991RsmwRTqLGSQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=uM9LnmJ6; arc=none smtp.client-ip=113.46.200.221 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="uM9LnmJ6" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=q06cRr8Qj+2tDNsNLIuurUn3/bkoAcG2p2ERpvKWfFU=; b=uM9LnmJ6TKbBoNMOIzLya+BskVr/U++gLHYKgTsmKB222N4Z0gmGCZOfE3cTSDhgsJsWIWKFf EBPnlLENNt+Gy2B1aU6Dlo38nrO5xzjuPM6ngf51zCGlR4TLDUfoU/Q/HQV+BpVazaRTxKzACqd CRDK5eyc8uHhFTwR75o2GgE= Received: from mail.maildlp.com (unknown [172.19.162.140]) by canpmsgout06.his.huawei.com (SkyGuard) with ESMTPS id 4hGfPT5bFTzRhVP; Fri, 7 Aug 2026 17:44:29 +0800 (CST) Received: from kwepemo500018.china.huawei.com (unknown [7.202.195.199]) by mail.maildlp.com (Postfix) with ESMTPS id 0B72120333; Fri, 7 Aug 2026 17:55:02 +0800 (CST) Received: from localhost.huawei.com (10.90.31.46) by kwepemo500018.china.huawei.com (7.202.195.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.45; Fri, 7 Aug 2026 17:55:01 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , , Subject: [PATCH v2 net-next 1/3] net: hns3: set msg->desc to NULL after kfree in hclge_query_reg_info() Date: Fri, 7 Aug 2026 17:54:33 +0800 Message-ID: <20260807095435.2959246-2-shaojijie@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260807095435.2959246-1-shaojijie@huawei.com> References: <20260807095435.2959246-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemo500018.china.huawei.com (7.202.195.199) Content-Type: text/plain; charset="utf-8" From: Jian Shen In hclge_query_reg_info(), msg->desc is freed by kfree(), but the caller continues to use msg across loop iterations. Set msg->desc to NULL to avoid leaving a dangling pointer in the reused struct. Signed-off-by: Jian Shen Signed-off-by: Jijie Shao Reviewed-by: Simon Horman --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c b/drive= rs/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c index dac051e798da..7e124e2c718d 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c @@ -1592,6 +1592,7 @@ hclge_query_reg_info(struct hclge_dev *hdev, } =20 kfree(msg->desc); + msg->desc =3D NULL; } =20 static void hclge_query_reg_info_of_ssu(struct hclge_dev *hdev) --=20 2.33.0 From nobody Tue Sep 29 13:20:38 2026 Received: from canpmsgout03.his.huawei.com (canpmsgout03.his.huawei.com [113.46.200.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C118D377ED7; Fri, 7 Aug 2026 09:55:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786096508; cv=none; b=VU0Ds/JmjLNHjIHIQKlMcxvbmJpEajX1U6QgGkhsx+QruZuuOnnzs1vly5vZPAj8RWCcXhX661fstCrHguhOCGRMrPDUf202GLLQWdhYAqLTb5YJiqCQkiA0SEhMw046GoZ1QQbjc88DZSaBM/OQTU/1BiHHpLp5Pa6MYWAztJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786096508; c=relaxed/simple; bh=KCtRJ+a5gZ9ziP+VCBdd/234T81s+X2T53qgzmmgj+g=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NhG5VHwSj9B37JW3JC4gVsQ2B954szCeXg+vXqs6YQoegMXDe5zeOv6UYocAerKXwI0OFKscxHXisFhZuEnDR+tlma19xaeF7on1/8nf5DKBWSNfE3HyzOxw/a7hn73W+8+iHremV2e+3ziqbFEwEWymTQ55n+4spxzBAtxy1/k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=KgyCfvzo; arc=none smtp.client-ip=113.46.200.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="KgyCfvzo" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=QVgfmBluaZnUjMLr50+g3Vh7nfXTTGPctw64a+rZv24=; b=KgyCfvzo8K2j4os4s4u330vIRTu5d5oDlLEiJy/Vn4YDYBW9LxBin1M0CRAWIFxnUzTaljORN UBFK29AvlNX63a7bjGEOXyujPDxi03DrszpWKd+q2BBFZq5Zzzbzu7HBWH/Z1eCrpKQL2MWk8M9 POnKOXIsKF67RisnwF4LzC8= Received: from mail.maildlp.com (unknown [172.19.162.223]) by canpmsgout03.his.huawei.com (SkyGuard) with ESMTPS id 4hGfQd2Y2wzpSvQ; Fri, 7 Aug 2026 17:45:29 +0800 (CST) Received: from kwepemo500018.china.huawei.com (unknown [7.202.195.199]) by mail.maildlp.com (Postfix) with ESMTPS id 90F0840561; Fri, 7 Aug 2026 17:55:02 +0800 (CST) Received: from localhost.huawei.com (10.90.31.46) by kwepemo500018.china.huawei.com (7.202.195.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.45; Fri, 7 Aug 2026 17:55:01 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , , Subject: [PATCH v2 net-next 2/3] net: hns3: add missing const qualifier to hclge_log_error() reg parameter Date: Fri, 7 Aug 2026 17:54:34 +0800 Message-ID: <20260807095435.2959246-3-shaojijie@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260807095435.2959246-1-shaojijie@huawei.com> References: <20260807095435.2959246-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemo500018.china.huawei.com (7.202.195.199) Content-Type: text/plain; charset="utf-8" The reg parameter of hclge_log_error() is never modified within the function, but is declared as 'char *'. Callers pass const strings, causing a compiler warning about discarding the 'const' qualifier. Add the missing const to fix the warning. Signed-off-by: Jijie Shao Reviewed-by: Simon Horman --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c b/drive= rs/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c index 7e124e2c718d..6093a60d257b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c @@ -1762,7 +1762,7 @@ static const struct hclge_hw_type_id hclge_hw_type_id= _st[] =3D { }, }; =20 -static void hclge_log_error(struct device *dev, char *reg, +static void hclge_log_error(struct device *dev, const char *reg, const struct hclge_hw_error *err, u32 err_sts, unsigned long *reset_requests) { --=20 2.33.0 From nobody Tue Sep 29 13:20:38 2026 Received: from canpmsgout10.his.huawei.com (canpmsgout10.his.huawei.com [113.46.200.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 431DF364942; Fri, 7 Aug 2026 09:55:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.225 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786096510; cv=none; b=U29XhNwfGVLIpIhHDyla8qIaj8Gi4B9SKpaZzzdJQ8eRV2oDDUhVSa/eIzBASqShuYqM7B8zROd9nHHUmPhCCFFVRRmu3vURtAlowhCUNzF2mnL1p66Fisl4ts4YS1n9lWpdJrmjIKIs3wMBQLr46ofZg1D6osntpIpFjvngPb0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786096510; c=relaxed/simple; bh=sXJT/i4T8Y/i1dpiQ0hI6DwNGhbr3te0HCa4Am2V1z0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ub3c21Lgfe9owkMMM9bQs5tHJZT6KkgXcqcs/odliBOvScBjdmz2f41xkhxPp0/kpP87DK0JoTho/uEPRWCyCva+PiCmodN6Uox6uUEpUxPj/S6D2CDXldh9NpoAZ3fMaQW+2I+PxQarEyQY3zslTcAQe96K8bHvGxCefBZjmAU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=aPxfxZKF; arc=none smtp.client-ip=113.46.200.225 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="aPxfxZKF" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=Wj/YKLTbFip53atrpIExASDYQUL2EmPFh7HcTco3lPA=; b=aPxfxZKFTUlNRpiavJGsWX5oVgK/YBK5mGxTJ50sW/an5qhocSG6owLrNWZgSX1inrpGCv8Ux kjaTIOQ0zCKAr1tLpvJE+Fw0jVsHdc5iAauMN7IDWfYfaqlzvhFmMyFbsFgRWajWNDrCLIwug+C pryynISbfpSoymgvPtfSOQU= Received: from mail.maildlp.com (unknown [172.19.163.15]) by canpmsgout10.his.huawei.com (SkyGuard) with ESMTPS id 4hGfPT19hYz1K96b; Fri, 7 Aug 2026 17:44:29 +0800 (CST) Received: from kwepemo500018.china.huawei.com (unknown [7.202.195.199]) by mail.maildlp.com (Postfix) with ESMTPS id 170CB40586; Fri, 7 Aug 2026 17:55:03 +0800 (CST) Received: from localhost.huawei.com (10.90.31.46) by kwepemo500018.china.huawei.com (7.202.195.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.45; Fri, 7 Aug 2026 17:55:02 +0800 From: Jijie Shao To: , , , , , CC: , , , , , , , Subject: [PATCH v2 net-next 3/3] net: hns3: use txqueue parameter directly in ndo_tx_timeout Date: Fri, 7 Aug 2026 17:54:35 +0800 Message-ID: <20260807095435.2959246-4-shaojijie@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20260807095435.2959246-1-shaojijie@huawei.com> References: <20260807095435.2959246-1-shaojijie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemo500018.china.huawei.com (7.202.195.199) Content-Type: text/plain; charset="utf-8" From: Jian Shen The ndo_tx_timeout callback already provides the timed out txqueue index. Use it directly instead of iterating all tx queues to find the timed out one. Use h->kinfo.num_tqps for the bounds check instead of ndev->num_tx_queues, as the ring array is allocated with num_tqps entries and num_tx_queues may be larger. This issue has not been encountered in practice, so it is folded into this cleanup rather than tracked as a separate bugfix. Signed-off-by: Jian Shen Signed-off-by: Jijie Shao Reviewed-by: Simon Horman --- Changes in v2: - Use h->kinfo.num_tqps for bounds check instead of ndev->num_tx_queues - Restore the netif_xmit_timeout_ms() check by making hns3_dump_timeout_queue() return bool and gating on its return value, so a cleared stall does not trigger a reset - Fold the bounds fix into this patch rather than tracking it as a separate bugfix, as the OOB has not been encountered in practice v1: https://lore.kernel.org/all/20260804130933.880552-1-shaojijie@huawei.co= m/ --- .../net/ethernet/hisilicon/hns3/hns3_enet.c | 48 +++++++++---------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/= ethernet/hisilicon/hns3/hns3_enet.c index 6ecb32e28e79..47788be64be6 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -2825,32 +2825,28 @@ static int hns3_nic_change_mtu(struct net_device *n= etdev, int new_mtu) return ret; } =20 -static int hns3_get_timeout_queue(struct net_device *ndev) +static bool hns3_dump_timeout_queue(struct net_device *ndev, + unsigned int txqueue) { - unsigned int i; - - /* Find the stopped queue the same way the stack does */ - for (i =3D 0; i < ndev->num_tx_queues; i++) { - unsigned int timedout_ms; - struct netdev_queue *q; + unsigned int timedout_ms; + struct netdev_queue *q; =20 - q =3D netdev_get_tx_queue(ndev, i); - timedout_ms =3D netif_xmit_timeout_ms(q); - if (timedout_ms) { + q =3D netdev_get_tx_queue(ndev, txqueue); + timedout_ms =3D netif_xmit_timeout_ms(q); + if (timedout_ms) { #ifdef CONFIG_BQL - struct dql *dql =3D &q->dql; + struct dql *dql =3D &q->dql; =20 - netdev_info(ndev, "DQL info last_cnt: %u, queued: %u, adj_limit: %u, co= mpleted: %u\n", - dql->last_obj_cnt, dql->num_queued, - dql->adj_limit, dql->num_completed); + netdev_info(ndev, "DQL info last_cnt: %u, queued: %u, adj_limit: %u, com= pleted: %u\n", + dql->last_obj_cnt, dql->num_queued, + dql->adj_limit, dql->num_completed); #endif - netdev_info(ndev, "queue state: 0x%lx, delta msecs: %u\n", - q->state, timedout_ms); - break; - } + netdev_info(ndev, "queue state: 0x%lx, delta msecs: %u\n", + q->state, timedout_ms); + return true; } =20 - return i; + return false; } =20 static void hns3_dump_queue_stats(struct net_device *ndev, @@ -2900,15 +2896,15 @@ static void hns3_dump_queue_reg(struct net_device *= ndev, HNS3_RING_TX_RING_EBD_OFFSET_REG)); } =20 -static bool hns3_get_tx_timeo_queue_info(struct net_device *ndev) +static bool hns3_get_tx_timeo_queue_info(struct net_device *ndev, + unsigned int txqueue) { struct hns3_nic_priv *priv =3D netdev_priv(ndev); struct hnae3_handle *h =3D hns3_get_handle(ndev); struct hns3_enet_ring *tx_ring; - u32 timeout_queue; =20 - timeout_queue =3D hns3_get_timeout_queue(ndev); - if (timeout_queue >=3D ndev->num_tx_queues) { + if (txqueue >=3D h->kinfo.num_tqps || + !hns3_dump_timeout_queue(ndev, txqueue)) { netdev_info(ndev, "no netdev TX timeout queue found, timeout count: %llu\n", priv->tx_timeout_count); @@ -2917,8 +2913,8 @@ static bool hns3_get_tx_timeo_queue_info(struct net_d= evice *ndev) =20 priv->tx_timeout_count++; =20 - tx_ring =3D &priv->ring[timeout_queue]; - hns3_dump_queue_stats(ndev, tx_ring, timeout_queue); + tx_ring =3D &priv->ring[txqueue]; + hns3_dump_queue_stats(ndev, tx_ring, txqueue); =20 /* When mac received many pause frames continuous, it's unable to send * packets, which may cause tx timeout @@ -2941,7 +2937,7 @@ static void hns3_nic_net_timeout(struct net_device *n= dev, unsigned int txqueue) struct hns3_nic_priv *priv =3D netdev_priv(ndev); struct hnae3_handle *h =3D priv->ae_handle; =20 - if (!hns3_get_tx_timeo_queue_info(ndev)) + if (!hns3_get_tx_timeo_queue_info(ndev, txqueue)) return; =20 /* request the reset, and let the hclge to determine --=20 2.33.0