Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2895735pxb; Tue, 24 Aug 2021 10:04:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJylKm+EnnEfGa2GVG2ifwbcP88s9gGVSH4/IOXTcEdJ8/UnpxrPMUrYkt0oDcu8H6XyZtyp X-Received: by 2002:a05:6402:2709:: with SMTP id y9mr44881561edd.231.1629824687759; Tue, 24 Aug 2021 10:04:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629824687; cv=none; d=google.com; s=arc-20160816; b=U/XYpDeAfuv/puPVXQRuuz9tilAqW1BWGhnDCac1FDxjZKX10/H8Hloq6dAIMF9sW3 Y6zN09v7SIXG96hL+eTr9QAhk+upXeY+XHqYy9CqX2wScwSWEEfvCGj8Syxf9GFZ5hVW ZPYPVrK7nZnXk6hVDbjWoEuZEJS0RqVal4vvh3VKEncygti+XxhVp0KpDjPm3frKwIV7 rtoTPfzRtbegx3m2v1lVubfQMhE/8JH1yWhcS1bRy4xBsq2fKWZfjRfHZo3Es+P+6dIU BTSxJD4JUK7knwZq3hBzCpdEObdzGfSYv3nH9pYJGiLFwLcj4A1G6UxijJ1Awgcb5quK nclg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=60uJpFzaBWWQd+jm8/Wxj9OdqLqVLbpTJ/ZN5Wy3mHk=; b=ZGcA7V1d10mUMJuV5CzgcaDkcN8taAnnLNwXHGKdGkJWgK4S0LEGpRyj3Dj9t6PgZz bWOR0JWJg3EcZT3DTkYnO456QyXfZunOKRyVGhZDDULgjhdu3AYsgPfC/chIdnpq28MM 3xGbhj2evhlp0Q5/Qn1bd+lyVZjDEeC5KeT+hp2oNG3xOUB5qnzGzOhq5Lt/tI/uRRro RA/bgdwd02pUeLLi3KpHYI4S34r47Z59T3Wb6JY5kRljQct89hBCs2AUfPfj/X1t9P/D DKTKT/3E79HTQcN6Av4R8fCNK8QmlxFOhuWiBWKtItXWiNnzs+jqxPayeQhAfDKncl5K vn5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VIP0feB8; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr8si12477386ejc.307.2021.08.24.10.04.23; Tue, 24 Aug 2021 10:04:47 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VIP0feB8; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238832AbhHXRBI (ORCPT + 99 others); Tue, 24 Aug 2021 13:01:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:38972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238439AbhHXQ6M (ORCPT ); Tue, 24 Aug 2021 12:58:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 76EEE61528; Tue, 24 Aug 2021 16:57:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824231; bh=xDhQbOxLw/2SU2OWJ+CljTm8FSMGxI4Xfq9H+HN84HA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VIP0feB89jA7zwRrsmZZGECRyjcjpjFKiMnWUTB/5sTfaC5lQqfqXut//pinfxN5g phFGn6iuGi2kdQS6L+xDICi/RCSfL5NNDaSh5c7Db+mnXc2PWtgMKKQJfhgWaD9nN2 WkPVPl4x8V1vrH84esq7kcPiSIXVrxYfk8x67mwIBEOzKl26WKx1VI3e78o8STeIA7 WMSJ3pacxN95opFAyQ5/eqZo6Nn9fj9fgSfi/cL2TXnMrgX6v55/ibtltxAwCHlJlG 3PudKL6JEKxOMjempjap0SBlRtpa3i0Bl7wg0zm+n6JtysY02gu0wBMF7Wqci3j9y7 UBwZsJwhHSjHA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Wang Hai , Magnus Karlsson , Sandeep Penigalapati , Tony Nguyen , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.13 064/127] ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path Date: Tue, 24 Aug 2021 12:55:04 -0400 Message-Id: <20210824165607.709387-65-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165607.709387-1-sashal@kernel.org> References: <20210824165607.709387-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.13.13-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.13.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.13.13-rc1 X-KernelTest-Deadline: 2021-08-26T16:55+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wang Hai [ Upstream commit 1b80fec7b043552e01609bae7d0aad07aa742adc ] 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 Acked-by: Magnus Karlsson Tested-by: Sandeep Penigalapati Signed-off-by: Tony Nguyen Link: https://lore.kernel.org/r/20210817203736.3529939-1-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- 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 f72d2978263b..d60da7a89092 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.30.2