From nobody Wed Nov 27 02:30:26 2024 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 215BB1ADFFC; Mon, 14 Oct 2024 14:51:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728917496; cv=none; b=V7vUGBtxIL3/tc1gUzPMXgnXPPV6vjFz9l5T/O703JSY70GBJRayh4T0LdpYrgWUBIFinEG1+Iw6Ec8MUXENOJPYUlZgyElXx/VcIeSxzBhTw+IPByPGBP+fDBffNTfVhe2RFvXJbnh9iRIywdO+g3HEU4WoHtiTKFhO+M/Etd4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728917496; c=relaxed/simple; bh=+K54uAbbDwC2HFwGOZC96oVcWPkn9nhNEJLhCQncXeY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=VS/HjDCT1wqm5fiQLd3m4Bx/v7JhhJ56YdSze8LPlx76JSFnkcLGiulPKirMZXIc+yjLv90qeBVkPZsWWvWgPQiH3m9lBargkPqqGQq2/vT4Zzrl9DEzHr8G+mdDdxHe6ENvUlJ1kuOifwIjbuM9/EDrNdD714gTfd24hp+Rkh0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4XS0Vz4vCQzpWtp; Mon, 14 Oct 2024 22:49:31 +0800 (CST) Received: from kwepemm600001.china.huawei.com (unknown [7.193.23.3]) by mail.maildlp.com (Postfix) with ESMTPS id 6BF8D1800DE; Mon, 14 Oct 2024 22:51:30 +0800 (CST) Received: from huawei.com (10.175.113.133) by kwepemm600001.china.huawei.com (7.193.23.3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 14 Oct 2024 22:51:29 +0800 From: Wang Hai To: , , , , , , CC: , , Subject: [PATCH net] net: systemport: fix potential memory leak in bcm_sysport_xmit() Date: Mon, 14 Oct 2024 22:51:15 +0800 Message-ID: <20241014145115.44977-1-wanghai38@huawei.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600001.china.huawei.com (7.193.23.3) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The bcm_sysport_xmit() returns NETDEV_TX_OK without freeing skb in case of dma_map_single() fails, add dev_kfree_skb() to fix it. Fixes: 80105befdb4b ("net: systemport: add Broadcom SYSTEMPORT Ethernet MAC= driver") Signed-off-by: Wang Hai Acked-by: Florian Fainelli --- drivers/net/ethernet/broadcom/bcmsysport.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ether= net/broadcom/bcmsysport.c index c9faa8540859..0a68b526e4a8 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -1359,6 +1359,7 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *s= kb, netif_err(priv, tx_err, dev, "DMA map failed at %p (len=3D%d)\n", skb->data, skb_len); ret =3D NETDEV_TX_OK; + dev_kfree_skb_any(skb); goto out; } =20 --=20 2.17.1