Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2677857pxj; Mon, 31 May 2021 08:04:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAW3FDMsVXSY74/YW08fxtqEqGsA2kuf5lEgM7a5lgt5rVIX4zYRRNbmMCsLPNn71vY8xQ X-Received: by 2002:a6b:8e04:: with SMTP id q4mr17517813iod.54.1622473449266; Mon, 31 May 2021 08:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622473449; cv=none; d=google.com; s=arc-20160816; b=dyDZoG7WHZjrTxhF20P4vPvsQLfE60YU3xmn+pFSaDRMh+/v+cc2tBTopp6epdkwlR mAfg/HiM5Zzk3HS+G4SISYMab9R3TJ+jTc0hCnpFTPqc2V/dD1D7AhHKo+VLu5iAsBlG /SgEpFYgeqggNxq1UacY14dmeQN+BqwgGN2BOQ2if/siMzuMZlKtbx9ya+UIV1lm4HIP JoJgiYjAWi8FffLu5QpQX/FwG+XRIPE9PDNPN4szqoXb8XixazSIEXKlIrlFmJsMoBLg AtnshQJsxMDHS2Dbl0YtUVBAjXd9XwKtPUYBiAfqnF3MX/HawCROaALmwKCU4nnf60BB CSbw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+Qpzb8FXAmXgwzNvWOiuGz1IEJTPjBOR5oxF+js71YA=; b=OV4nSXVca6KfAYTKB2hDiJU1d+9wOZcJoTmM9QDLl+ZWy9mDtNshvrHGs4pwMGgcBT +QfrrNKsTnqiwtJyayaQVsoI0PDyAo02uwt5PflHn/H8/d/BtN/Vxnj+0hadZF372BFN SR6NO9Nbt8l2sgqOQ/KTwfuwjr/tzaei7cBmBO3VejRmcqaiT7p3d2DJD0AocjOX88BD mg7ObgmP0ltnj3wYkZV2K3FZuSJkbmHbyy6iBgkf3uWL4cRE+hiAFOcCJV0/AptMcQyC H8VfHPC4Sb1DP7mwstsENYMiuUpAZk0xU4zTZdY+PEnCwCD/l62ziqJJsYlLV/DVV13T L4yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VbC0wxhS; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k17si14371152ion.39.2021.05.31.08.03.54; Mon, 31 May 2021 08:04:09 -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=@linuxfoundation.org header.s=korg header.b=VbC0wxhS; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234517AbhEaPEg (ORCPT + 99 others); Mon, 31 May 2021 11:04:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:40232 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233298AbhEaOHf (ORCPT ); Mon, 31 May 2021 10:07:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7DD586195D; Mon, 31 May 2021 13:39:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468367; bh=lVmYbOfXRPQDI0BHM560+nSRPOfXdZPEgZZTm6SwwjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VbC0wxhSc6amVD9ZSPXr5CKqHlDY6DX4vsfDnGarwT8EFYtU3Ur94ufSz42hiFhOG ONXcfV4S1wm/7B98v1KPDk3SG6r123PVeMgwJJwO1YFsnq+KezfgxrLzzClEXPH9dr 2FqY77Ym6YCsyTWVYp9pLkF1Q4ueXKhYRR0tKYwo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Catherine Sullivan , David Awogbemila , Willem de Bruijn , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 216/252] gve: Check TX QPL was actually assigned Date: Mon, 31 May 2021 15:14:41 +0200 Message-Id: <20210531130705.357113930@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Catherine Sullivan [ Upstream commit 5aec55b46c6238506cdf0c60cd0e42ab77a1e5e0 ] Correctly check the TX QPL was assigned and unassigned if other steps in the allocation fail. Fixes: f5cedc84a30d (gve: Add transmit and receive support) Signed-off-by: Catherine Sullivan Signed-off-by: David Awogbemila Acked-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/google/gve/gve_tx.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/google/gve/gve_tx.c b/drivers/net/ethernet/google/gve/gve_tx.c index d0244feb0301..30532ee28dd3 100644 --- a/drivers/net/ethernet/google/gve/gve_tx.c +++ b/drivers/net/ethernet/google/gve/gve_tx.c @@ -207,10 +207,12 @@ static int gve_tx_alloc_ring(struct gve_priv *priv, int idx) goto abort_with_info; tx->tx_fifo.qpl = gve_assign_tx_qpl(priv); + if (!tx->tx_fifo.qpl) + goto abort_with_desc; /* map Tx FIFO */ if (gve_tx_fifo_init(priv, &tx->tx_fifo)) - goto abort_with_desc; + goto abort_with_qpl; tx->q_resources = dma_alloc_coherent(hdev, @@ -229,6 +231,8 @@ static int gve_tx_alloc_ring(struct gve_priv *priv, int idx) abort_with_fifo: gve_tx_fifo_release(priv, &tx->tx_fifo); +abort_with_qpl: + gve_unassign_qpl(priv, tx->tx_fifo.qpl->id); abort_with_desc: dma_free_coherent(hdev, bytes, tx->desc, tx->bus); tx->desc = NULL; -- 2.30.2