Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2710298pxj; Mon, 31 May 2021 08:49:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx16u0mudfetByyvmkHdojGESxowyWysTU0j9+U4kUcvBhIwrHmp6ZDOoITcO0x779kmpJN X-Received: by 2002:a05:6e02:12c9:: with SMTP id i9mr5187722ilm.17.1622476143286; Mon, 31 May 2021 08:49:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622476143; cv=none; d=google.com; s=arc-20160816; b=f/Xzp0cUDdbzRBnozDYsuX6zOUppTgMKgCYa2oxaMWI2wMf/reuTg6daYtPsp5CoE5 1nObiW9L7xDsQMBSq7sK5Eau+3iE9LKIdizaVuAZ2dUkJ7qu++5yLnwlweMlI2ZDyhBH zoG3pKN75iP6Eeb+3tlK0iMssMG54uWPBpfNZAATxn3kkjgNBLXnjnVx+2JMES1F0RaW 1GXPrb7mZsv/cpk7y0XNgD4/HJTY3LPtEKqmIoPMKURl1UIiPG5AMvdR//+1j5DA/8id RCUWHSG//OBk6End8H+IEM0WNzrUOKC+MW+fZOEr24udNwvHUrpZ+oWh6qbvAk0TklDX VG7g== 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=ve84OQjseiG56pmxY5AvvvoTHOaQb3T8zLoTb14t3v9q9FKiMa0NBkAt7Ab928oeKs iM5mLBiEpsNyNxweV8uZwOg+bik0soqHCxMW7kmKJTduDgkZIn8zKzA74w16i1z9Y8qF sqHKhrAcz19+jrXBxdXqMCmc7FSTt+Bo84V9LKCTrBhGJFbBLfnMBtXP7+jTE0mU8Qla XHFUfYrshVaW/Qtonon+Ue+ugkqJhTLntZI5UtGGYjwc+067HGIEHLylFN5tw8U9emVi xiGtMTqLnkc3eXkxe3RBt7tykgtLxnsZVjUAGvLfDo4sZ+PUic57mt6ZtKukQ6mWo3Kj dC8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SDJzS9Vv; 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 5si16495361ilx.117.2021.05.31.08.48.50; Mon, 31 May 2021 08:49:03 -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=SDJzS9Vv; 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 S232132AbhEaPsz (ORCPT + 99 others); Mon, 31 May 2021 11:48:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:56130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233700AbhEaO10 (ORCPT ); Mon, 31 May 2021 10:27:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C7344615A0; Mon, 31 May 2021 13:47:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468853; bh=lVmYbOfXRPQDI0BHM560+nSRPOfXdZPEgZZTm6SwwjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDJzS9Vvw7Xe8+VCfYbjcKE9vVMv8XWTEbMZEJPyCMaG+U6ribg6ImRkYM7YoB3BL 7ruZv9vL7nANq0OZaq2RHu95385SmMMDwQ9/qp5lHP04XlrYMvV8VwLcTYGTCS4biO gK1dYRIoN7vuJGH3m0FHdQqxnv0JVHTxv7tmrg70= 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.4 152/177] gve: Check TX QPL was actually assigned Date: Mon, 31 May 2021 15:15:09 +0200 Message-Id: <20210531130653.173600113@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@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