From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E57679C0 for ; Wed, 30 Nov 2022 18:47:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 980A8C433D6; Wed, 30 Nov 2022 18:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1669834075; bh=A0sM3Pc/fuCnyVm6wcdefXyUGSWQBrUVt+Qsie+zFRo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k6SYiqI1Kv8PJarhJKtaV0NGA1H/qjUqd7vNZPzWklVbNZoWvaGJQXZcZS2vkSmSE qjJp+UKL4UsaDY+gfCU3l37dz5uSrqI4Iiv92VDTTZ8sAH9Y/oMaMnEqohd9C4egJn PYqEOjXEM434GCCi03CUiRVddHtEElz5Wn3HCEYU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhang Changzhong , Martin Habets , Leon Romanovsky , Paolo Abeni , Sasha Levin Subject: [PATCH 6.0 120/289] sfc: fix potential memleak in __ef100_hard_start_xmit() Date: Wed, 30 Nov 2022 19:21:45 +0100 Message-Id: <20221130180546.860813434@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221130180544.105550592@linuxfoundation.org> References: <20221130180544.105550592@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Zhang Changzhong [ Upstream commit aad98abd5cb8133507f22654f56bcb443aaa2d89 ] The __ef100_hard_start_xmit() returns NETDEV_TX_OK without freeing skb in error handling case, add dev_kfree_skb_any() to fix it. Fixes: 51b35a454efd ("sfc: skeleton EF100 PF driver") Signed-off-by: Zhang Changzhong Acked-by: Martin Habets Reviewed-by: Leon Romanovsky Link: https://lore.kernel.org/r/1668671409-10909-1-git-send-email-zhangchangzhong@huawei.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/sfc/ef100_netdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/sfc/ef100_netdev.c b/drivers/net/ethernet/sfc/ef100_netdev.c index 17b9d37218cb..4c33c3b5f32b 100644 --- a/drivers/net/ethernet/sfc/ef100_netdev.c +++ b/drivers/net/ethernet/sfc/ef100_netdev.c @@ -217,6 +217,7 @@ netdev_tx_t __ef100_hard_start_xmit(struct sk_buff *skb, skb->len, skb->data_len, channel->channel); if (!efx->n_channels || !efx->n_tx_channels || !channel) { netif_stop_queue(net_dev); + dev_kfree_skb_any(skb); goto err; } -- 2.35.1