Skip to contentSkip to conversation

virtio_net: Fix memory leak in virtnet_rx_mod_work

PATCH Applied Daniel Jurgens 5 participants 5 messages May 9, 2024 – May 11, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio_net: Fix memory leak in virtnet_rx_mod_work

The pointer delcaration was missing the __free(kfree).

Fixes ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")
---
 drivers/net/virtio_net.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/virtio_net.c +1 -2
index df6121c38a1b..42da535913ed 100644
@@ -2884,7 +2884,6 @@ static int virtnet_set_queues(struct virtnet_info *vi, u16 queue_pairs)
 
 static int virtnet_close(struct net_device *dev)
 {
-	u8 *promisc_allmulti  __free(kfree) = NULL;
 	struct virtnet_info *vi = netdev_priv(dev);
 	int i;
 
@@ -2905,11 +2904,11 @@ static void virtnet_rx_mode_work(struct work_struct *work)
 {
 	struct virtnet_info *vi =
 		container_of(work, struct virtnet_info, rx_mode_work);
+	u8 *promisc_allmulti  __free(kfree) = NULL;
 	struct net_device *dev = vi->dev;
 	struct scatterlist sg[2];
 	struct virtio_net_ctrl_mac *mac_data;
 	struct netdev_hw_addr *ha;
-	u8 *promisc_allmulti;
 	int uc_count;
 	int mc_count;
 	void *buf;
Signature · 1 line
2.45.0
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Daniel Jurgens
Quoted 6 lines · Daniel Jurgens

The pointer delcaration was missing the __free(kfree).

Fixes ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")
Quoted 32 lines
---
 drivers/net/virtio_net.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/virtio_net.c +1 -3
index df6121c38a1b..42da535913ed 100644
@@ -2884,7 +2884,6 @@ static int virtnet_set_queues(struct virtnet_info *vi, u16 queue_pairs)
 
 static int virtnet_close(struct net_device *dev)
 {
-	u8 *promisc_allmulti  __free(kfree) = NULL;
 	struct virtnet_info *vi = netdev_priv(dev);
 	int i;
 
@@ -2905,11 +2904,11 @@ static void virtnet_rx_mode_work(struct work_struct *work)
 {
 	struct virtnet_info *vi =
 		container_of(work, struct virtnet_info, rx_mode_work);
+	u8 *promisc_allmulti  __free(kfree) = NULL;
 	struct net_device *dev = vi->dev;
 	struct scatterlist sg[2];
 	struct virtio_net_ctrl_mac *mac_data;
 	struct netdev_hw_addr *ha;
-	u8 *promisc_allmulti;
 	int uc_count;
 	int mc_count;
 	void *buf;
--

2.45.0

maintainer Acked-by on v1 1/1
#3 lore raw
In reply to Daniel Jurgens
Quoted 6 lines · Daniel Jurgens

The pointer delcaration was missing the __free(kfree).

Fixes ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")
Quoted 31 lines
---
 drivers/net/virtio_net.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/virtio_net.c +1 -2
index df6121c38a1b..42da535913ed 100644
@@ -2884,7 +2884,6 @@ static int virtnet_set_queues(struct virtnet_info *vi, u16 queue_pairs)
 
 static int virtnet_close(struct net_device *dev)
 {
-	u8 *promisc_allmulti  __free(kfree) = NULL;
 	struct virtnet_info *vi = netdev_priv(dev);
 	int i;
 
@@ -2905,11 +2904,11 @@ static void virtnet_rx_mode_work(struct work_struct *work)
 {
 	struct virtnet_info *vi =
 		container_of(work, struct virtnet_info, rx_mode_work);
+	u8 *promisc_allmulti  __free(kfree) = NULL;
 	struct net_device *dev = vi->dev;
 	struct scatterlist sg[2];
 	struct virtio_net_ctrl_mac *mac_data;
 	struct netdev_hw_addr *ha;
-	u8 *promisc_allmulti;
 	int uc_count;
 	int mc_count;
 	void *buf;
Signature · 1 line
2.45.0
#4 lore raw
In reply to Daniel Jurgens
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 9 May 2024 13:36:34 -0500 you wrote:

The pointer delcaration was missing the __free(kfree).

Fixes ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")

[...]

Here is the summary with links:
- virtio_net: Fix memory leak in virtnet_rx_mod_work

    https://git.kernel.org/netdev/net-next/c/b49bd37f0bfd

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html