Netdev Archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio_net: Fix memory leak in virtnet_rx_mod_work
@ 2024-05-09 18:36 Daniel Jurgens
  2024-05-09 18:42 ` Jens Axboe
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Daniel Jurgens @ 2024-05-09 18:36 UTC (permalink / raw
  To: netdev
  Cc: mst, jasowang, xuanzhuo, virtualization, davem, edumazet, kuba,
	pabeni, jiri, axboe, Daniel Jurgens

The pointer delcaration was missing the __free(kfree).

Fixes: ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")
Reported-by: Jens Axboe <axboe@kernel.dk>
Closes: https://lore.kernel.org/netdev/0674ca1b-020f-4f93-94d0-104964566e3f@kernel.dk/
Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
---
 drivers/net/virtio_net.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index df6121c38a1b..42da535913ed 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] virtio_net: Fix memory leak in virtnet_rx_mod_work
  2024-05-09 18:36 [PATCH] virtio_net: Fix memory leak in virtnet_rx_mod_work Daniel Jurgens
@ 2024-05-09 18:42 ` Jens Axboe
  2024-05-10  1:19 ` Xuan Zhuo
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2024-05-09 18:42 UTC (permalink / raw
  To: Daniel Jurgens, netdev
  Cc: mst, jasowang, xuanzhuo, virtualization, davem, edumazet, kuba,
	pabeni, jiri

On 5/9/24 12:36 PM, Daniel Jurgens wrote:
> The pointer delcaration was missing the __free(kfree).

Works for me:

Tested-by: Jens Axboe <axboe@kernel.dk>

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] virtio_net: Fix memory leak in virtnet_rx_mod_work
  2024-05-09 18:36 [PATCH] virtio_net: Fix memory leak in virtnet_rx_mod_work Daniel Jurgens
  2024-05-09 18:42 ` Jens Axboe
@ 2024-05-10  1:19 ` Xuan Zhuo
  2024-05-10 10:07 ` Michael S. Tsirkin
  2024-05-11  1:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Xuan Zhuo @ 2024-05-10  1:19 UTC (permalink / raw
  To: Daniel Jurgens
  Cc: mst, jasowang, xuanzhuo, virtualization, davem, edumazet, kuba,
	pabeni, jiri, axboe, Daniel Jurgens, netdev

On Thu, 9 May 2024 13:36:34 -0500, Daniel Jurgens <danielj@nvidia.com> wrote:
> The pointer delcaration was missing the __free(kfree).
>
> Fixes: ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")
> Reported-by: Jens Axboe <axboe@kernel.dk>
> Closes: https://lore.kernel.org/netdev/0674ca1b-020f-4f93-94d0-104964566e3f@kernel.dk/
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>

Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>


> ---
>  drivers/net/virtio_net.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index df6121c38a1b..42da535913ed 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] virtio_net: Fix memory leak in virtnet_rx_mod_work
  2024-05-09 18:36 [PATCH] virtio_net: Fix memory leak in virtnet_rx_mod_work Daniel Jurgens
  2024-05-09 18:42 ` Jens Axboe
  2024-05-10  1:19 ` Xuan Zhuo
@ 2024-05-10 10:07 ` Michael S. Tsirkin
  2024-05-11  1:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2024-05-10 10:07 UTC (permalink / raw
  To: Daniel Jurgens
  Cc: netdev, jasowang, xuanzhuo, virtualization, davem, edumazet, kuba,
	pabeni, jiri, axboe

On Thu, May 09, 2024 at 01:36:34PM -0500, Daniel Jurgens wrote:
> The pointer delcaration was missing the __free(kfree).
> 
> Fixes: ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")
> Reported-by: Jens Axboe <axboe@kernel.dk>
> Closes: https://lore.kernel.org/netdev/0674ca1b-020f-4f93-94d0-104964566e3f@kernel.dk/
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  drivers/net/virtio_net.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index df6121c38a1b..42da535913ed 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] virtio_net: Fix memory leak in virtnet_rx_mod_work
  2024-05-09 18:36 [PATCH] virtio_net: Fix memory leak in virtnet_rx_mod_work Daniel Jurgens
                   ` (2 preceding siblings ...)
  2024-05-10 10:07 ` Michael S. Tsirkin
@ 2024-05-11  1:30 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-11  1:30 UTC (permalink / raw
  To: Dan Jurgens
  Cc: netdev, mst, jasowang, xuanzhuo, virtualization, davem, edumazet,
	kuba, pabeni, jiri, axboe

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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")
> Reported-by: Jens Axboe <axboe@kernel.dk>
> Closes: https://lore.kernel.org/netdev/0674ca1b-020f-4f93-94d0-104964566e3f@kernel.dk/
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-05-11  1:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-09 18:36 [PATCH] virtio_net: Fix memory leak in virtnet_rx_mod_work Daniel Jurgens
2024-05-09 18:42 ` Jens Axboe
2024-05-10  1:19 ` Xuan Zhuo
2024-05-10 10:07 ` Michael S. Tsirkin
2024-05-11  1:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).