* [PATCH v3] virtio_net: Fix missed rtnl_unlock
@ 2024-05-15 16:31 Daniel Jurgens
2024-05-15 16:35 ` Brett Creeley
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Daniel Jurgens @ 2024-05-15 16:31 UTC (permalink / raw)
To: netdev
Cc: mst, jasowang, xuanzhuo, virtualization, davem, edumazet, kuba,
pabeni, jiri, Daniel Jurgens, Eric Dumazet
The rtnl_lock would stay locked if allocating promisc_allmulti failed.
Also changed the allocation to GFP_KERNEL.
Fixes: ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")
Reported-by: Eric Dumazet <edumaset@google.com>
Link: https://lore.kernel.org/netdev/CANn89iLazVaUCvhPm6RPJJ0owra_oFnx7Fhc8d60gV-65ad3WQ@mail.gmail.com/
Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
---
v3:
- Changed to promisc_allmulti alloc to GPF_KERNEL
v2:
- Added fixes tag.
---
drivers/net/virtio_net.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 19a9b50646c7..4e1a0fc0d555 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -2902,14 +2902,14 @@ static void virtnet_rx_mode_work(struct work_struct *work)
if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_RX))
return;
- rtnl_lock();
-
- promisc_allmulti = kzalloc(sizeof(*promisc_allmulti), GFP_ATOMIC);
+ promisc_allmulti = kzalloc(sizeof(*promisc_allmulti), GFP_KERNEL);
if (!promisc_allmulti) {
dev_warn(&dev->dev, "Failed to set RX mode, no memory.\n");
return;
}
+ rtnl_lock();
+
*promisc_allmulti = !!(dev->flags & IFF_PROMISC);
sg_init_one(sg, promisc_allmulti, sizeof(*promisc_allmulti));
--
2.45.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3] virtio_net: Fix missed rtnl_unlock
2024-05-15 16:31 [PATCH v3] virtio_net: Fix missed rtnl_unlock Daniel Jurgens
@ 2024-05-15 16:35 ` Brett Creeley
2024-05-15 16:39 ` Eric Dumazet
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Brett Creeley @ 2024-05-15 16:35 UTC (permalink / raw)
To: Daniel Jurgens, netdev
Cc: mst, jasowang, xuanzhuo, virtualization, davem, edumazet, kuba,
pabeni, jiri, Eric Dumazet
On 5/15/2024 9:31 AM, Daniel Jurgens wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> The rtnl_lock would stay locked if allocating promisc_allmulti failed.
> Also changed the allocation to GFP_KERNEL.
>
> Fixes: ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")
> Reported-by: Eric Dumazet <edumaset@google.com>
> Link: https://lore.kernel.org/netdev/CANn89iLazVaUCvhPm6RPJJ0owra_oFnx7Fhc8d60gV-65ad3WQ@mail.gmail.com/
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
> ---
> v3:
> - Changed to promisc_allmulti alloc to GPF_KERNEL
> v2:
> - Added fixes tag.
> ---
> drivers/net/virtio_net.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 19a9b50646c7..4e1a0fc0d555 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -2902,14 +2902,14 @@ static void virtnet_rx_mode_work(struct work_struct *work)
> if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_RX))
> return;
>
> - rtnl_lock();
> -
> - promisc_allmulti = kzalloc(sizeof(*promisc_allmulti), GFP_ATOMIC);
> + promisc_allmulti = kzalloc(sizeof(*promisc_allmulti), GFP_KERNEL);
> if (!promisc_allmulti) {
> dev_warn(&dev->dev, "Failed to set RX mode, no memory.\n");
> return;
> }
>
> + rtnl_lock();
> +
> *promisc_allmulti = !!(dev->flags & IFF_PROMISC);
> sg_init_one(sg, promisc_allmulti, sizeof(*promisc_allmulti));
>
> --
> 2.45.0
Reviewed-by: Brett Creeley <brett.creeley@amd.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3] virtio_net: Fix missed rtnl_unlock
2024-05-15 16:31 [PATCH v3] virtio_net: Fix missed rtnl_unlock Daniel Jurgens
2024-05-15 16:35 ` Brett Creeley
@ 2024-05-15 16:39 ` Eric Dumazet
2024-05-15 21:42 ` Michael S. Tsirkin
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Eric Dumazet @ 2024-05-15 16:39 UTC (permalink / raw)
To: Daniel Jurgens
Cc: netdev, mst, jasowang, xuanzhuo, virtualization, davem, kuba,
pabeni, jiri, Eric Dumazet
On Wed, May 15, 2024 at 6:32 PM Daniel Jurgens <danielj@nvidia.com> wrote:
>
> The rtnl_lock would stay locked if allocating promisc_allmulti failed.
> Also changed the allocation to GFP_KERNEL.
>
> Fixes: ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")
> Reported-by: Eric Dumazet <edumaset@google.com>
> Link: https://lore.kernel.org/netdev/CANn89iLazVaUCvhPm6RPJJ0owra_oFnx7Fhc8d60gV-65ad3WQ@mail.gmail.com/
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Thanks !
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3] virtio_net: Fix missed rtnl_unlock
2024-05-15 16:31 [PATCH v3] virtio_net: Fix missed rtnl_unlock Daniel Jurgens
2024-05-15 16:35 ` Brett Creeley
2024-05-15 16:39 ` Eric Dumazet
@ 2024-05-15 21:42 ` Michael S. Tsirkin
2024-05-15 22:17 ` Michael S. Tsirkin
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2024-05-15 21:42 UTC (permalink / raw)
To: Daniel Jurgens
Cc: netdev, jasowang, xuanzhuo, virtualization, davem, edumazet, kuba,
pabeni, jiri, Eric Dumazet
On Wed, May 15, 2024 at 11:31:25AM -0500, Daniel Jurgens wrote:
> The rtnl_lock would stay locked if allocating promisc_allmulti failed.
> Also changed the allocation to GFP_KERNEL.
>
> Fixes: ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")
> Reported-by: Eric Dumazet <edumaset@google.com>
> Link: https://lore.kernel.org/netdev/CANn89iLazVaUCvhPm6RPJJ0owra_oFnx7Fhc8d60gV-65ad3WQ@mail.gmail.com/
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> v3:
> - Changed to promisc_allmulti alloc to GPF_KERNEL
> v2:
> - Added fixes tag.
> ---
> drivers/net/virtio_net.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 19a9b50646c7..4e1a0fc0d555 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -2902,14 +2902,14 @@ static void virtnet_rx_mode_work(struct work_struct *work)
> if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_RX))
> return;
>
> - rtnl_lock();
> -
> - promisc_allmulti = kzalloc(sizeof(*promisc_allmulti), GFP_ATOMIC);
> + promisc_allmulti = kzalloc(sizeof(*promisc_allmulti), GFP_KERNEL);
> if (!promisc_allmulti) {
> dev_warn(&dev->dev, "Failed to set RX mode, no memory.\n");
> return;
> }
>
> + rtnl_lock();
> +
> *promisc_allmulti = !!(dev->flags & IFF_PROMISC);
> sg_init_one(sg, promisc_allmulti, sizeof(*promisc_allmulti));
>
> --
> 2.45.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3] virtio_net: Fix missed rtnl_unlock
2024-05-15 16:31 [PATCH v3] virtio_net: Fix missed rtnl_unlock Daniel Jurgens
` (2 preceding siblings ...)
2024-05-15 21:42 ` Michael S. Tsirkin
@ 2024-05-15 22:17 ` Michael S. Tsirkin
2024-05-16 4:47 ` Jason Wang
2024-05-17 2:40 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: Michael S. Tsirkin @ 2024-05-15 22:17 UTC (permalink / raw)
To: Daniel Jurgens
Cc: netdev, jasowang, xuanzhuo, virtualization, davem, edumazet, kuba,
pabeni, jiri, Eric Dumazet
On Wed, May 15, 2024 at 11:31:25AM -0500, Daniel Jurgens wrote:
> The rtnl_lock would stay locked if allocating promisc_allmulti failed.
> Also changed the allocation to GFP_KERNEL.
>
> Fixes: ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")
> Reported-by: Eric Dumazet <edumaset@google.com>
> Link: https://lore.kernel.org/netdev/CANn89iLazVaUCvhPm6RPJJ0owra_oFnx7Fhc8d60gV-65ad3WQ@mail.gmail.com/
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
net tree I presume.
> ---
> v3:
> - Changed to promisc_allmulti alloc to GPF_KERNEL
> v2:
> - Added fixes tag.
> ---
> drivers/net/virtio_net.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 19a9b50646c7..4e1a0fc0d555 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -2902,14 +2902,14 @@ static void virtnet_rx_mode_work(struct work_struct *work)
> if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_RX))
> return;
>
> - rtnl_lock();
> -
> - promisc_allmulti = kzalloc(sizeof(*promisc_allmulti), GFP_ATOMIC);
> + promisc_allmulti = kzalloc(sizeof(*promisc_allmulti), GFP_KERNEL);
> if (!promisc_allmulti) {
> dev_warn(&dev->dev, "Failed to set RX mode, no memory.\n");
> return;
> }
>
> + rtnl_lock();
> +
> *promisc_allmulti = !!(dev->flags & IFF_PROMISC);
> sg_init_one(sg, promisc_allmulti, sizeof(*promisc_allmulti));
>
> --
> 2.45.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3] virtio_net: Fix missed rtnl_unlock
2024-05-15 16:31 [PATCH v3] virtio_net: Fix missed rtnl_unlock Daniel Jurgens
` (3 preceding siblings ...)
2024-05-15 22:17 ` Michael S. Tsirkin
@ 2024-05-16 4:47 ` Jason Wang
2024-05-17 2:40 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: Jason Wang @ 2024-05-16 4:47 UTC (permalink / raw)
To: Daniel Jurgens
Cc: netdev, mst, xuanzhuo, virtualization, davem, edumazet, kuba,
pabeni, jiri, Eric Dumazet
On Thu, May 16, 2024 at 12:32 AM Daniel Jurgens <danielj@nvidia.com> wrote:
>
> The rtnl_lock would stay locked if allocating promisc_allmulti failed.
> Also changed the allocation to GFP_KERNEL.
>
> Fixes: ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")
> Reported-by: Eric Dumazet <edumaset@google.com>
> Link: https://lore.kernel.org/netdev/CANn89iLazVaUCvhPm6RPJJ0owra_oFnx7Fhc8d60gV-65ad3WQ@mail.gmail.com/
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3] virtio_net: Fix missed rtnl_unlock
2024-05-15 16:31 [PATCH v3] virtio_net: Fix missed rtnl_unlock Daniel Jurgens
` (4 preceding siblings ...)
2024-05-16 4:47 ` Jason Wang
@ 2024-05-17 2:40 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-17 2:40 UTC (permalink / raw)
To: Daniel Jurgens
Cc: netdev, mst, jasowang, xuanzhuo, virtualization, davem, edumazet,
kuba, pabeni, jiri, edumaset
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 15 May 2024 11:31:25 -0500 you wrote:
> The rtnl_lock would stay locked if allocating promisc_allmulti failed.
> Also changed the allocation to GFP_KERNEL.
>
> Fixes: ff7c7d9f5261 ("virtio_net: Remove command data from control_buf")
> Reported-by: Eric Dumazet <edumaset@google.com>
> Link: https://lore.kernel.org/netdev/CANn89iLazVaUCvhPm6RPJJ0owra_oFnx7Fhc8d60gV-65ad3WQ@mail.gmail.com/
> Signed-off-by: Daniel Jurgens <danielj@nvidia.com>
>
> [...]
Here is the summary with links:
- [v3] virtio_net: Fix missed rtnl_unlock
https://git.kernel.org/netdev/net/c/fa033def4171
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] 7+ messages in thread
end of thread, other threads:[~2024-05-17 2:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-15 16:31 [PATCH v3] virtio_net: Fix missed rtnl_unlock Daniel Jurgens
2024-05-15 16:35 ` Brett Creeley
2024-05-15 16:39 ` Eric Dumazet
2024-05-15 21:42 ` Michael S. Tsirkin
2024-05-15 22:17 ` Michael S. Tsirkin
2024-05-16 4:47 ` Jason Wang
2024-05-17 2:40 ` 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 NNTP newsgroup(s).