* [RFC PATCH v1] virtio/vsock: check transport before skb allocation
@ 2023-03-17 10:37 Arseniy Krasnov
2023-03-17 21:54 ` Bobby Eshleman
2023-03-20 13:58 ` Stefano Garzarella
0 siblings, 2 replies; 3+ messages in thread
From: Arseniy Krasnov @ 2023-03-17 10:37 UTC (permalink / raw)
To: Stefan Hajnoczi, Stefano Garzarella, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Bobby Eshleman
Cc: kvm, virtualization, netdev, linux-kernel, kernel, oxffffaa, avkrasnov
Pointer to transport could be checked before allocation of skbuff, thus
there is no need to free skbuff when this pointer is NULL.
Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
---
net/vmw_vsock/virtio_transport_common.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index cda587196475..607149259e8b 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -867,6 +867,9 @@ static int virtio_transport_reset_no_sock(const struct virtio_transport *t,
if (le16_to_cpu(hdr->op) == VIRTIO_VSOCK_OP_RST)
return 0;
+ if (!t)
+ return -ENOTCONN;
+
reply = virtio_transport_alloc_skb(&info, 0,
le64_to_cpu(hdr->dst_cid),
le32_to_cpu(hdr->dst_port),
@@ -875,11 +878,6 @@ static int virtio_transport_reset_no_sock(const struct virtio_transport *t,
if (!reply)
return -ENOMEM;
- if (!t) {
- kfree_skb(reply);
- return -ENOTCONN;
- }
-
return t->send_pkt(reply);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC PATCH v1] virtio/vsock: check transport before skb allocation
2023-03-17 10:37 [RFC PATCH v1] virtio/vsock: check transport before skb allocation Arseniy Krasnov
@ 2023-03-17 21:54 ` Bobby Eshleman
2023-03-20 13:58 ` Stefano Garzarella
1 sibling, 0 replies; 3+ messages in thread
From: Bobby Eshleman @ 2023-03-17 21:54 UTC (permalink / raw)
To: Arseniy Krasnov
Cc: Stefan Hajnoczi, Stefano Garzarella, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Bobby Eshleman, kvm,
virtualization, netdev, linux-kernel, kernel, oxffffaa
On Fri, Mar 17, 2023 at 01:37:10PM +0300, Arseniy Krasnov wrote:
> Pointer to transport could be checked before allocation of skbuff, thus
> there is no need to free skbuff when this pointer is NULL.
>
> Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
> ---
> net/vmw_vsock/virtio_transport_common.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
> index cda587196475..607149259e8b 100644
> --- a/net/vmw_vsock/virtio_transport_common.c
> +++ b/net/vmw_vsock/virtio_transport_common.c
> @@ -867,6 +867,9 @@ static int virtio_transport_reset_no_sock(const struct virtio_transport *t,
> if (le16_to_cpu(hdr->op) == VIRTIO_VSOCK_OP_RST)
> return 0;
>
> + if (!t)
> + return -ENOTCONN;
> +
> reply = virtio_transport_alloc_skb(&info, 0,
> le64_to_cpu(hdr->dst_cid),
> le32_to_cpu(hdr->dst_port),
> @@ -875,11 +878,6 @@ static int virtio_transport_reset_no_sock(const struct virtio_transport *t,
> if (!reply)
> return -ENOMEM;
>
> - if (!t) {
> - kfree_skb(reply);
> - return -ENOTCONN;
> - }
> -
> return t->send_pkt(reply);
> }
>
> --
> 2.25.1
LGTM.
Reviewed-by: Bobby Eshleman <bobby.eshleman@bytedance.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC PATCH v1] virtio/vsock: check transport before skb allocation
2023-03-17 10:37 [RFC PATCH v1] virtio/vsock: check transport before skb allocation Arseniy Krasnov
2023-03-17 21:54 ` Bobby Eshleman
@ 2023-03-20 13:58 ` Stefano Garzarella
1 sibling, 0 replies; 3+ messages in thread
From: Stefano Garzarella @ 2023-03-20 13:58 UTC (permalink / raw)
To: Arseniy Krasnov
Cc: Stefan Hajnoczi, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Bobby Eshleman, kvm, virtualization, netdev,
linux-kernel, kernel, oxffffaa
On Fri, Mar 17, 2023 at 01:37:10PM +0300, Arseniy Krasnov wrote:
>Pointer to transport could be checked before allocation of skbuff, thus
>there is no need to free skbuff when this pointer is NULL.
>
>Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
>---
> net/vmw_vsock/virtio_transport_common.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
LGTM, I think net-next is fine for this.
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Thanks,
Stefano
>
>diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
>index cda587196475..607149259e8b 100644
>--- a/net/vmw_vsock/virtio_transport_common.c
>+++ b/net/vmw_vsock/virtio_transport_common.c
>@@ -867,6 +867,9 @@ static int virtio_transport_reset_no_sock(const struct virtio_transport *t,
> if (le16_to_cpu(hdr->op) == VIRTIO_VSOCK_OP_RST)
> return 0;
>
>+ if (!t)
>+ return -ENOTCONN;
>+
> reply = virtio_transport_alloc_skb(&info, 0,
> le64_to_cpu(hdr->dst_cid),
> le32_to_cpu(hdr->dst_port),
>@@ -875,11 +878,6 @@ static int virtio_transport_reset_no_sock(const struct virtio_transport *t,
> if (!reply)
> return -ENOMEM;
>
>- if (!t) {
>- kfree_skb(reply);
>- return -ENOTCONN;
>- }
>-
> return t->send_pkt(reply);
> }
>
>--
>2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-20 13:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17 10:37 [RFC PATCH v1] virtio/vsock: check transport before skb allocation Arseniy Krasnov
2023-03-17 21:54 ` Bobby Eshleman
2023-03-20 13:58 ` Stefano Garzarella
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).