Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3211506pxj; Mon, 7 Jun 2021 05:18:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbmsba7JUmFaPur2ytq208rwFGHubIdTfL5PXeC9QwyIT/SSs5SsVOBYoTceHBVFU/oEuu X-Received: by 2002:a17:906:4c57:: with SMTP id d23mr17451060ejw.147.1623068329084; Mon, 07 Jun 2021 05:18:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623068329; cv=none; d=google.com; s=arc-20160816; b=Nw/htHsJORgFSbVjM6D+v8bPuySVlYVau8QU19OnT7C9HUzEzj4AKXl1+AmXjG6f8x 6pf7SCk1z9BjZiwGGnh1SDCA/KWaXrHn9SpHZDZHuhOA2E4QD+6TUJg5MPOIKBmwstGF 84IppqddLpXsK5eIZ8ApATcOsTr2VpYvaP8fsUxCvkWuoFCcdgIqgieJyzP9kXzG+11i zecpsYHjPq0LW13uHe1U1zndkZPD4aboKh42nGnhXwVKCCbzjJnv6zZDOVhjksgWyxGV hQ2dZn2Mz8o+BP+x+mtSPUlFdaJ0YSJssj5Wf0A6GpRftkHKWdYtFnSSY/6SHf3tOB+c NHIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=Y1iNLfu594+0iDtOz8uv4CShw/DFR/Ww3OjrUCNCpSU=; b=b3hT7HSKEIR5a3+vPIGlLrflqadtGfu+hJkHItSVYQc3b0IrxIrS+JFPkkYe44hjXM 5zCYmDE1BqstVDbbySWJkvlfSQVJoHB8pPp5VQWcsdmG55GVF9UvBEYptmSGoVxzFHoB 3FDzHIcFokcX6Brtob7nNF6qOkJLF9sWgV5F0RaU7qkW0ldnIqbRdWmBby3fIsNB8/Mm BP//atIL1grnzyVRz2Njn+T7YL+btws38TVxSH4xpTdqY4iIwti3vPBomreSXvH+NUdV XClkoQgFYhk3yuwbgEEjklvpeB3ZtH4cPOTvnGXyR4y5zLNJpAnqwAfphCJRpSh+jOlX TzUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e6si13952792edz.65.2021.06.07.05.18.26; Mon, 07 Jun 2021 05:18:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230323AbhFGMSc (ORCPT + 99 others); Mon, 7 Jun 2021 08:18:32 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:7127 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230145AbhFGMSc (ORCPT ); Mon, 7 Jun 2021 08:18:32 -0400 Received: from dggeme766-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FzC2k5bF6zYspX; Mon, 7 Jun 2021 20:13:50 +0800 (CST) Received: from huawei.com (10.175.113.133) by dggeme766-chm.china.huawei.com (10.3.19.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 7 Jun 2021 20:16:38 +0800 From: Wang Hai To: , , , , , , , , , , CC: , , , Subject: [PATCH net] ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path Date: Mon, 7 Jun 2021 20:26:44 +0800 Message-ID: <20210607122644.59021-1-wanghai38@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.113.133] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggeme766-chm.china.huawei.com (10.3.19.112) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In ixgbe_xsk_pool_enable(), if ixgbe_xsk_wakeup() fails, We should restore the previous state and clean up the resources. Add the missing clear af_xdp_zc_qps and unmap dma to fix this bug. Fixes: d49e286d354e ("ixgbe: add tracking of AF_XDP zero-copy state for each queue pair") Fixes: 4a9b32f30f80 ("ixgbe: fix potential RX buffer starvation for AF_XDP") Signed-off-by: Wang Hai --- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c index 91ad5b902673..d912f14d2ba4 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c @@ -52,8 +52,11 @@ static int ixgbe_xsk_pool_enable(struct ixgbe_adapter *adapter, /* Kick start the NAPI context so that receiving will start */ err = ixgbe_xsk_wakeup(adapter->netdev, qid, XDP_WAKEUP_RX); - if (err) + if (err) { + clear_bit(qid, adapter->af_xdp_zc_qps); + xsk_pool_dma_unmap(pool, IXGBE_RX_DMA_ATTR); return err; + } } return 0; -- 2.17.1