Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2900770pxb; Tue, 24 Aug 2021 10:11:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZAmcZxSgFzQuwTdd36La1N+G1SjHxT4vHaOt2h7yz0RbqnlbfyoV+exJZeWhXesyxdIRk X-Received: by 2002:a6b:d915:: with SMTP id r21mr20311535ioc.76.1629825079304; Tue, 24 Aug 2021 10:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629825079; cv=none; d=google.com; s=arc-20160816; b=MEQSfbLjYQfTLS/FWOalZ400ip3WSk1mLFt1VktKUf2rBaPvhxEqI8syZ5Dt+xG0C0 MPe8ZI3v/V2X+mWApACdWE/hTXkgEfS+DgKx8mMNzZlYqDelk9IDwpQPCXi6I/J4yURR icDUgnGMT3E2ZNPuBXRjk9vm9n24iKvkuaumjBTDFQzrKeDZ5JpkcWw+AH83BoZ+Se/b vb5dSnABeB7N2AcJzxLyAozyeWLVd/vgpwEyvLW+qQaJKKkI5lOiA1eF1fhIEW9lajil q/sESr8HLoFnNmH72BGQ/qV1+mVh9n0GHy84j6D2n4dt2iUQ/5q2qJqoWbb+q8F9KBYx m/hQ== 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=Mzcut1DNiqVG/Jz3r6ixCHDXdEthu+7f/xnMVkanE+i6SLI4xTKCg0YYniMDwZL0Sq EOrM815B8E0TG7c24ekI8oisxSQ8dsNgJBEG0v1Vg/fgcLQ3B3otAFIQlE24KRT1mTt8 yHaS2jpu5xHP/Y7yTVwtgIMHsHOKw77swq9oODSsrBuHY7AVhjes3ha1SQYzLISD9yXH AcpibS3QWGQwpsnJmMe/VtoSEIlbEewPaRiw+ZbXSL4NG/gWFPoFpJVmkcrEfd/vmokc vJq06WfCNoPxz+foZerR9dwNlYDPR7W4mqnWiHd/A4urAbWHM5rpoRr9uj33Mn4jdeoA U6Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ICDmlzRd; 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 r17si20028947ilj.23.2021.08.24.10.11.07; Tue, 24 Aug 2021 10:11:19 -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=ICDmlzRd; 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 S240292AbhHXRLF (ORCPT + 99 others); Tue, 24 Aug 2021 13:11:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:51854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239227AbhHXRIw (ORCPT ); Tue, 24 Aug 2021 13:08:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C435061A0A; Tue, 24 Aug 2021 17:00:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824410; bh=xDhQbOxLw/2SU2OWJ+CljTm8FSMGxI4Xfq9H+HN84HA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ICDmlzRd082/BD/howyo7c/Q1zsomow6O2bHADCABuAtad3lYLhxx6l5bG22t3M7B vMG74gK903QshUFzxRr8HC78XvQw2KIEuBk17EUnlHzdsLYBRW44i5ukNB7UN2XnaU qD2HpXwOa96t1TqMguj6waWoDs15S9v9DEHCQ+mKgAnoc3u9ZT2NX+U9RqFWUBeqPs nDr6tBJ2TSYIsI0DGsX/Ou8kp3pqymUlqAhM7a76F0rLyCUoHG3ceohcinHNOUzfna c7ZDo2W/yTg/YYpcB0F85aJA2ve9qccGABSzq9b1JC7zooa6RBx10gVHvjEABPgMwE LEH6h5CvKYhYg== 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.10 61/98] ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path Date: Tue, 24 Aug 2021 12:58:31 -0400 Message-Id: <20210824165908.709932-62-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165908.709932-1-sashal@kernel.org> References: <20210824165908.709932-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.10.61-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.10.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.10.61-rc1 X-KernelTest-Deadline: 2021-08-26T16:58+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