From nobody Wed Oct 8 20:57:55 2025 Received: from baidu.com (mx22.baidu.com [220.181.50.185]) (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 1E51E291C1A; Tue, 24 Jun 2025 14:08:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.181.50.185 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750774110; cv=none; b=WAGqntSU+ChS05/aUBtXvZFNQpw5oRxsrs4dbsgbGdtCqG4FJbZIvzvVhHPJSlZd/ct3jBhM0ycFIt/cHfvVAZ6blkYCE5WsafQ1KKNMrJj5THgyIiIhxQ75Whi1Y/i7/F2TcRMn41npvQ+rRdFgULpE5dJkNqyMKtOeVpFShhI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750774110; c=relaxed/simple; bh=loaHwNBI/gYKVHKNJjfT1pONOJEkBbwHCLkGhDebm1w=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=UNZOEaMPWOwD+MLZvf4lkYMIqWGykS49J7D1myrwI3XPnflJTauTgEi5e24fqhwLX6TA+SIixpRaDYCr6LcVKPivYAmi2v+Wu+biycYY2O4u3IfTMifvA5ffA8BoQlIEnGFt5wAi7tlxehDN5JBHy1nzzH/DbNGEQW87FE/sDyk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=baidu.com; spf=pass smtp.mailfrom=baidu.com; arc=none smtp.client-ip=220.181.50.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=baidu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baidu.com From: Fushuai Wang To: , , , , , , , CC: , , , Fushuai Wang Subject: [PATCH net-next] net/mlx5e: Fix error handling in RQ memory model registration Date: Tue, 24 Jun 2025 22:07:30 +0800 Message-ID: <20250624140730.67150-1-wangfushuai@baidu.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) 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: bjkjy-exc2.internal.baidu.com (172.31.50.46) To bjkjy-mail-ex22.internal.baidu.com (172.31.50.16) X-FEAS-Client-IP: 172.31.50.16 X-FE-Policy-ID: 52:10:53:SYSTEM Content-Type: text/plain; charset="utf-8" Currently when xdp_rxq_info_reg_mem_model() fails in the XSK path, the error handling incorrectly jumps to err_destroy_page_pool. While this may not cause errors, we should make it jump to the correct location. Signed-off-by: Fushuai Wang Acked-by: Dragos Tatulea Reviewed-by: Zhu Yanjun --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/ne= t/ethernet/mellanox/mlx5/core/en_main.c index ea822c69d137..1e3ba51b7995 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -915,6 +915,8 @@ static int mlx5e_alloc_rq(struct mlx5e_params *params, if (xsk) { err =3D xdp_rxq_info_reg_mem_model(&rq->xdp_rxq, MEM_TYPE_XSK_BUFF_POOL, NULL); + if (err) + goto err_free_by_rq_type; xsk_pool_set_rxq_info(rq->xsk_pool, &rq->xdp_rxq); } else { /* Create a page_pool and register it with rxq */ @@ -941,12 +943,13 @@ static int mlx5e_alloc_rq(struct mlx5e_params *params, rq->page_pool =3D NULL; goto err_free_by_rq_type; } - if (xdp_rxq_info_is_reg(&rq->xdp_rxq)) + if (xdp_rxq_info_is_reg(&rq->xdp_rxq)) { err =3D xdp_rxq_info_reg_mem_model(&rq->xdp_rxq, MEM_TYPE_PAGE_POOL, rq->page_pool); + if (err) + goto err_destroy_page_pool; + } } - if (err) - goto err_destroy_page_pool; =20 for (i =3D 0; i < wq_sz; i++) { if (rq->wq_type =3D=3D MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ) { --=20 2.36.1