Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp484877imn; Wed, 27 Jul 2022 11:30:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1swoZvVhSN2cWwikvr6q5EHrCCOtotqDC38wmK7tu0oj33hxdHGuFdL2n/2sHvdFy4isDZo X-Received: by 2002:a17:907:2888:b0:72e:e912:ab5b with SMTP id em8-20020a170907288800b0072ee912ab5bmr18683250ejc.356.1658946622820; Wed, 27 Jul 2022 11:30:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946622; cv=none; d=google.com; s=arc-20160816; b=Swbozr9/+CwXMb6TMVpoN1PEFiUdtMUji0WI9sF2sghx2twvgSb8xUFx4cemzAM88M zXiLE3pnP4uXFmyqVAMOdcjdLkod2l0AhvV+s7f9HldOhRwQEk8yBb5YCH1SLW1dZeCt e5ZHYd9oOT4n5ddyzRLoEXoP+tUtV4yL0om6VYOGt+9EKATN0KpeyLVXpmjrswvz9gJq vE3GueRb3TEuLtbnzrWYw71dxyXZyk4Kp8TrSu9xcLGLZvCkgj9GiKDKC8SHpQP56z1Y mrLssxrxlseOClS10BgL2Rj+3lxhqtqv40dtba4R2N6j1ZDgwWESEoW09hzmhp3H6/fC JTng== 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=AcJ8njRZzfAY31McwZ15VNZ9Wq4xrgX+zVH/LOmvF38=; b=zXSm8Beq77NRIM7/Z6jtRyYJ6xKh33JdvYSAZ2DQV4Xme1RyVl97kSvrWpA1tlqGqN YVuO/JoTu2mLA2aqw0RpMPc7PiVrtlmo5m72MtuQvAdI8rhq7dgnHKwV543hTVbMMksb aeIubJCEd3IajKwPR8sQ5gKnh21rmmtlN6Jp+wYkvYFQlOfFYhUFV5p9rSXJyumzyCjB BkHjAXAZyn3UGmmCav99+AVWZNBu7WUomJNeqXQYCckBi8a2ms949ooIQIFmQZvSni+a aWRp2Va0ZrE+bmErP2Rgk1rpStBqV2bx0FRHozgTa/NF2hf3XOKjFPR/NWuRLkC+Ggwy DvqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ludhTKWY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n16-20020aa7c450000000b0043cc8647c7bsi1128783edr.525.2022.07.27.11.29.57; Wed, 27 Jul 2022 11:30:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ludhTKWY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S239408AbiG0Qk6 (ORCPT + 99 others); Wed, 27 Jul 2022 12:40:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239486AbiG0Qka (ORCPT ); Wed, 27 Jul 2022 12:40:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AB94501AC; Wed, 27 Jul 2022 09:29:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 676D5B821C2; Wed, 27 Jul 2022 16:29:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B98F8C433D6; Wed, 27 Jul 2022 16:29:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939353; bh=tgPNGXPOkBAd7r6Ni+4X8q4Ck+twZNZSzRrprPQ2w5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ludhTKWYbEbcIDM3LbK682452e9JMna5wHqJC+Fgy7q1/8HLNXw82RBUZGURguPTz 9nys4vGmIUVFguEoa+AgkDYVYbS+UcaQRAoz+9pLMlseCpzHe7vsm7ilCuz8EfXaNp uWxxvfQwgO/2rdTiENbwzFeRincMvSEwhYCMxdkg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Przemyslaw Patynowski , Jesse Brandeburg , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.4 39/87] iavf: Fix handling of dummy receive descriptors Date: Wed, 27 Jul 2022 18:10:32 +0200 Message-Id: <20220727161010.640531326@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161008.993711844@linuxfoundation.org> References: <20220727161008.993711844@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Przemyslaw Patynowski [ Upstream commit a9f49e0060301a9bfebeca76739158d0cf91cdf6 ] Fix memory leak caused by not handling dummy receive descriptor properly. iavf_get_rx_buffer now sets the rx_buffer return value for dummy receive descriptors. Without this patch, when the hardware writes a dummy descriptor, iavf would not free the page allocated for the previous receive buffer. This is an unlikely event but can still happen. [Jesse: massaged commit message] Fixes: efa14c398582 ("iavf: allow null RX descriptors") Signed-off-by: Przemyslaw Patynowski Signed-off-by: Jesse Brandeburg Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_txrx.c b/drivers/net/ethernet/intel/iavf/iavf_txrx.c index 7a30d5d5ef53..c6905d1b6182 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_txrx.c +++ b/drivers/net/ethernet/intel/iavf/iavf_txrx.c @@ -1263,11 +1263,10 @@ static struct iavf_rx_buffer *iavf_get_rx_buffer(struct iavf_ring *rx_ring, { struct iavf_rx_buffer *rx_buffer; - if (!size) - return NULL; - rx_buffer = &rx_ring->rx_bi[rx_ring->next_to_clean]; prefetchw(rx_buffer->page); + if (!size) + return rx_buffer; /* we are reusing so sync this buffer for CPU use */ dma_sync_single_range_for_cpu(rx_ring->dev, -- 2.35.1