diff mbox series

[net,v2,3/3] virtio/vsock: Improve MSG_ZEROCOPY error handling

Message ID 20241107-vsock-mem-leaks-v2-3-4e21bfcfc818@rbox.co (mailing list archive)
State New
Headers show
Series virtio/vsock: Fix memory leaks | expand

Commit Message

Michal Luczaj Nov. 7, 2024, 8:46 p.m. UTC
Add a missing kfree_skb() to prevent memory leaks.

Fixes: 581512a6dc93 ("vsock/virtio: MSG_ZEROCOPY flag support")
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Michal Luczaj <mhal@rbox.co>
---
 net/vmw_vsock/virtio_transport_common.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Arseniy Krasnov Nov. 11, 2024, 1:54 p.m. UTC | #1
On 07.11.2024 23:46, Michal Luczaj wrote:
> Add a missing kfree_skb() to prevent memory leaks.
> 
> Fixes: 581512a6dc93 ("vsock/virtio: MSG_ZEROCOPY flag support")
> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
> Signed-off-by: Michal Luczaj <mhal@rbox.co>
> ---
>  net/vmw_vsock/virtio_transport_common.c | 1 +
>  1 file changed, 1 insertion(+)

Acked-by: Arseniy Krasnov <avkrasnov@salutedevices.com>

> 
> diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
> index cd075f608d4f6f48f894543e5e9c966d3e5f22df..e2e6a30b759bdc6371bb0d63ee2e77c0ba148fd2 100644
> --- a/net/vmw_vsock/virtio_transport_common.c
> +++ b/net/vmw_vsock/virtio_transport_common.c
> @@ -400,6 +400,7 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,
>  			if (virtio_transport_init_zcopy_skb(vsk, skb,
>  							    info->msg,
>  							    can_zcopy)) {
> +				kfree_skb(skb);
>  				ret = -ENOMEM;
>  				break;
>  			}
>
diff mbox series

Patch

diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index cd075f608d4f6f48f894543e5e9c966d3e5f22df..e2e6a30b759bdc6371bb0d63ee2e77c0ba148fd2 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -400,6 +400,7 @@  static int virtio_transport_send_pkt_info(struct vsock_sock *vsk,
 			if (virtio_transport_init_zcopy_skb(vsk, skb,
 							    info->msg,
 							    can_zcopy)) {
+				kfree_skb(skb);
 				ret = -ENOMEM;
 				break;
 			}