lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1668775048-22031-1-git-send-email-zhangchangzhong@huawei.com>
Date:   Fri, 18 Nov 2022 20:37:27 +0800
From:   Zhang Changzhong <zhangchangzhong@...wei.com>
To:     Jesse Brandeburg <jesse.brandeburg@...el.com>,
        Tony Nguyen <anthony.l.nguyen@...el.com>,
        "David S. Miller" <davem@...emloft.net>,
        "Eric Dumazet" <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
        "Alexander Duyck" <alexander.h.duyck@...el.com>
CC:     Zhang Changzhong <zhangchangzhong@...wei.com>,
        <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH net] fm10k: fix potential memleak in fm10k_xmit_frame()

The fm10k_xmit_frame() returns NETDEV_TX_OK without freeing skb in error
handling case, add dev_kfree_skb() to fix it. Compile tested only.

Fixes: b101c9626477 ("fm10k: Add transmit and receive fastpath and interrupt handlers")
Signed-off-by: Zhang Changzhong <zhangchangzhong@...wei.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index 2cca9e8..c7b672a 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -531,8 +531,10 @@ static netdev_tx_t fm10k_xmit_frame(struct sk_buff *skb, struct net_device *dev)
 			return NETDEV_TX_OK;
 
 		/* make sure there is enough room to move the ethernet header */
-		if (unlikely(!pskb_may_pull(skb, VLAN_ETH_HLEN)))
+		if (unlikely(!pskb_may_pull(skb, VLAN_ETH_HLEN))) {
+			dev_kfree_skb(skb);
 			return NETDEV_TX_OK;
+		}
 
 		/* verify the skb head is not shared */
 		err = skb_cow_head(skb, 0);
-- 
2.9.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ