From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_HIGH,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27B20C28EBD for ; Sun, 9 Jun 2019 17:17:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EB970205F4 for ; Sun, 9 Jun 2019 17:17:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560100624; bh=0CV3ykOXup43iLMZFuI/xSseBucsOMh+EuMa+csKPtA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wUixz8d+qpgvGeMd5YJjRzHq1u9LuojU4Qe6f8ETQyVu5IjhPp6sK9lAAU5y3xrkT Ga4Ap2WwLAGlfPaWR9pzBGMxGGx0dA1t8WzanU0m9pDQ4mFHTGQonZt5tPHe8yigiD eJA8Ow6rmuvceW6wgsDL26UUuSlvMkV0y278jMPc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732215AbfFIQw1 (ORCPT ); Sun, 9 Jun 2019 12:52:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:53318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731394AbfFIQw1 (ORCPT ); Sun, 9 Jun 2019 12:52:27 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 07B62205ED; Sun, 9 Jun 2019 16:52:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560099146; bh=0CV3ykOXup43iLMZFuI/xSseBucsOMh+EuMa+csKPtA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a24cj2KtUqX77zB/LpBQWrIZCHTDsiNnhzE9nnZIKeud3kC14EMhiRT+jJ6sNnVTr xPnZ6HfvDVTZTSYAHEZ4MEGoukdH2IQlJ+kiQl4VaKCTMebSIfm9BuTRn63Tc8R1oG tRO37ExoneLrEpdt6p6LCgC+Cl8oKDj/FMN/oWSg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rakesh Hemnani , Michael Chan , "David S. Miller" Subject: [PATCH 4.9 08/83] bnxt_en: Fix aggregation buffer leak under OOM condition. Date: Sun, 9 Jun 2019 18:41:38 +0200 Message-Id: <20190609164128.290853125@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190609164127.843327870@linuxfoundation.org> References: <20190609164127.843327870@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Michael Chan [ Upstream commit 296d5b54163964b7ae536b8b57dfbd21d4e868e1 ] For every RX packet, the driver replenishes all buffers used for that packet and puts them back into the RX ring and RX aggregation ring. In one code path where the RX packet has one RX buffer and one or more aggregation buffers, we missed recycling the aggregation buffer(s) if we are unable to allocate a new SKB buffer. This leads to the aggregation ring slowly running out of buffers over time. Fix it by properly recycling the aggregation buffers. Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.") Reported-by: Rakesh Hemnani Signed-off-by: Michael Chan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1425,6 +1425,8 @@ static int bnxt_rx_pkt(struct bnxt *bp, skb = bnxt_copy_skb(bnapi, data, len, dma_addr); bnxt_reuse_rx_data(rxr, cons, data); if (!skb) { + if (agg_bufs) + bnxt_reuse_rx_agg_bufs(bnapi, cp_cons, agg_bufs); rc = -ENOMEM; goto next_rx; }