From patchwork Mon Mar 13 22:42:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13173421 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E67C4C6FD19 for ; Mon, 13 Mar 2023 22:45:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Pmq5AFCTUJfzXjj5BZnKlckB/Jp3M7uOQIrDt8/MdWc=; b=CtoVzz3tfd9++9 QK1O4zyEiJDTpTwmbHPqT+n4mu+vppDpODEIDxoByQW8G669voOEL/JJGZJgL/4huihzA1wq1y6ne z//PZzccucfoOrnbshfws1EsQsQDCP9vsPZWE5XHmJSVo4mC+/EREFVtczZMfSy+9Ui3lSqMPDsCq TiCtD1AYvLl8fF2Uje6ViONohJc1cPu3niaOCAdgptusBNvUxTRplOF4Kfbzd2m5DQup9O+hxrfys cHFAV8EnQq2RmVWQLsPVQPc5FKlFUQ/a+WPAUdFmhbPDobrQvgLn/mJpnKgSNfCqKEDtrWA1LVfnc cQtwILhMByBJHVRg/I/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbqu9-00877E-Bb; Mon, 13 Mar 2023 22:44:33 +0000 Received: from post.baikalelectronics.com ([213.79.110.86]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbqsb-0086Fv-Dx for linux-arm-kernel@lists.infradead.org; Mon, 13 Mar 2023 22:43:00 +0000 Received: from post.baikalelectronics.com (localhost.localdomain [127.0.0.1]) by post.baikalelectronics.com (Proxmox) with ESMTP id 9A924E0EB7; Tue, 14 Mar 2023 01:42:49 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= baikalelectronics.ru; h=cc:cc:content-transfer-encoding :content-type:content-type:date:from:from:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=post; bh=UBwRlpxjx2LCwbF2pseifbR70h2f/WK4HBXfWdEpoJM=; b=in1eMZuT/Ugr D2l0/iza7msPPk4K4FAVlDyf3kozMbRBIi7wYdXQ8GXI0E2TnLx9fI/39qTxB2Hx 33fZOCezw6x4luaIE+aqBqPcfjaNrfMPIYyArtiVdipb1nVV66WV+OTmlnTFrXUv lXt6pg0JrNrYtXg0fRkoYkLqXJowtuI= Received: from mail.baikal.int (mail.baikal.int [192.168.51.25]) by post.baikalelectronics.com (Proxmox) with ESMTP id 864F8E0E6A; Tue, 14 Mar 2023 01:42:49 +0300 (MSK) Received: from localhost (10.8.30.10) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 14 Mar 2023 01:42:48 +0300 From: Serge Semin To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Russell King , Andrew Lunn , Heiner Kallweit CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , Christian Marangi , Biao Huang , Yang Yingliang , , , , , Jose Abreu Subject: [PATCH net 06/13] net: stmmac: Free temporary Rx SKB on request Date: Tue, 14 Mar 2023 01:42:30 +0300 Message-ID: <20230313224237.28757-7-Sergey.Semin@baikalelectronics.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230313224237.28757-1-Sergey.Semin@baikalelectronics.ru> References: <20230313224237.28757-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-Originating-IP: [10.8.30.10] X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230313_154257_683358_3EF25529 X-CRM114-Status: GOOD ( 11.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In case if an incoming frame couldn't be finished in one stmmac_rx() method call an SKB used to collect data so far will be saved in the corresponding Rx-queue state buffer. If the network device is closed before the frame is completed the preserved SKB will be utilized on the next network interface link uprising cycle right on the first frame reception, which will cause having a confused set of SKB data. Let's free the allocated Rx SKB then when all Rx-buffers are requested to be freed. Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support") Signed-off-by: Serge Semin Reviewed-by: Piotr Raczynski --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index ee4297a25521..4d643b1bbf65 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1545,6 +1545,10 @@ static void dma_free_rx_skbufs(struct stmmac_priv *priv, for (i = 0; i < dma_conf->dma_rx_size; i++) stmmac_free_rx_buffer(priv, rx_q, i); + + if (rx_q->state_saved) + dev_kfree_skb(rx_q->state.skb); + rx_q->state_saved = false; } static int stmmac_alloc_rx_buffers(struct stmmac_priv *priv,