lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <MWHPR05MB33769A7039F0862F581BF176DA4E0@MWHPR05MB3376.namprd05.prod.outlook.com>
Date:   Thu, 21 Nov 2019 15:14:19 +0000
From:   Jorgen Hansen <jhansen@...are.com>
To:     'Stefano Garzarella' <sgarzare@...hat.com>,
        "davem@...emloft.net" <davem@...emloft.net>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "syzbot+e2e5c07bf353b2f79daa@...kaller.appspotmail.com" 
        <syzbot+e2e5c07bf353b2f79daa@...kaller.appspotmail.com>,
        Stefan Hajnoczi <stefanha@...hat.com>,
        Dexuan Cui <decui@...rosoft.com>
Subject: RE: [PATCH net-next] vsock: avoid to assign transport if its
 initialization fails

> From: Stefano Garzarella [mailto:sgarzare@...hat.com]
> Sent: Thursday, November 21, 2019 10:06 AM
> 
> 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@...kaller.appspotmail.com
> Signed-off-by: Stefano Garzarella <sgarzare@...hat.com>
> ---
>  net/vmw_vsock/af_vsock.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
> index cc8659838bf2..74db4cd637a7 100644
> --- a/net/vmw_vsock/af_vsock.c
> +++ b/net/vmw_vsock/af_vsock.c
> @@ -412,6 +412,7 @@ int vsock_assign_transport(struct vsock_sock *vsk,
> struct vsock_sock *psk)
>  	const struct vsock_transport *new_transport;
>  	struct sock *sk = sk_vsock(vsk);
>  	unsigned int remote_cid = vsk->remote_addr.svm_cid;
> +	int ret;
> 
>  	switch (sk->sk_type) {
>  	case SOCK_DGRAM:
> @@ -443,9 +444,15 @@ int vsock_assign_transport(struct vsock_sock *vsk,
> struct vsock_sock *psk)
>  	if (!new_transport || !try_module_get(new_transport->module))
>  		return -ENODEV;
> 
> +	ret = new_transport->init(vsk, psk);
> +	if (ret) {
> +		module_put(new_transport->module);
> +		return ret;
> +	}
> +
>  	vsk->transport = new_transport;
> 
> -	return vsk->transport->init(vsk, psk);
> +	return 0;
>  }
>  EXPORT_SYMBOL_GPL(vsock_assign_transport);
> 
> --
> 2.21.0

Reviewed-by: Jorgen Hansen <jhansen@...are.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ