Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

virtio/vsock: check transport before skb allocation

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>
Reviewed-by: Bobby Eshleman <bobby.eshleman@bytedance.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Link: https://lore.kernel.org/r/08d61bef-0c11-c7f9-9266-cb2109070314@sberdevices.ru
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Arseniy Krasnov and committed by
Paolo Abeni
4d1f5155 56c874f7

+3 -5
+3 -5
net/vmw_vsock/virtio_transport_common.c
··· 850 850 if (le16_to_cpu(hdr->op) == VIRTIO_VSOCK_OP_RST) 851 851 return 0; 852 852 853 + if (!t) 854 + return -ENOTCONN; 855 + 853 856 reply = virtio_transport_alloc_skb(&info, 0, 854 857 le64_to_cpu(hdr->dst_cid), 855 858 le32_to_cpu(hdr->dst_port), ··· 860 857 le32_to_cpu(hdr->src_port)); 861 858 if (!reply) 862 859 return -ENOMEM; 863 - 864 - if (!t) { 865 - kfree_skb(reply); 866 - return -ENOTCONN; 867 - } 868 860 869 861 return t->send_pkt(reply); 870 862 }