vsock: avoid to assign transport if its initialization fails
authorStefano Garzarella <sgarzare@redhat.com>
Thu, 21 Nov 2019 09:06:09 +0000 (10:06 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Nov 2019 19:37:16 +0000 (11:37 -0800)
commit039fcccaed338b2ff6587178c1219c1ef383a1d9
tree4818e35b1ac78089c6425093a69d32cb6e6b2f48
parentf3c9a666b28572b1a0ae691a47d9a7de4d9cefb3
vsock: avoid to assign transport if its initialization fails

If transport->init() fails, we can't assign the transport to the
socket, because it's not initialized correctly, and any future
calls to the transport callbacks would have an unexpected behavior.

Fixes: c0cfa2d8a788 ("vsock: add multi-transports support")
Reported-and-tested-by: syzbot+e2e5c07bf353b2f79daa@syzkaller.appspotmail.com
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/vmw_vsock/af_vsock.c