rxrpc: Validate the net address given to rxrpc_kernel_begin_call()
authorDavid Howells <dhowells@redhat.com>
Fri, 17 Jun 2016 10:00:48 +0000 (11:00 +0100)
committerDavid Howells <dhowells@redhat.com>
Wed, 22 Jun 2016 08:17:51 +0000 (09:17 +0100)
Validate the net address given to rxrpc_kernel_begin_call() before using
it.

Whilst this should be mostly unnecessary for in-kernel users, it does clear
the tail of the address struct in case we want to hash or compare the whole
thing.

Signed-off-by: David Howells <dhowells@redhat.com>
net/rxrpc/af_rxrpc.c

index 408bd02..b29bb50 100644 (file)
@@ -280,9 +280,14 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock,
        struct rxrpc_transport *trans;
        struct rxrpc_call *call;
        struct rxrpc_sock *rx = rxrpc_sk(sock->sk);
+       int ret;
 
        _enter(",,%x,%lx", key_serial(key), user_call_ID);
 
+       ret = rxrpc_validate_address(rx, srx, sizeof(*srx));
+       if (ret < 0)
+               return ERR_PTR(ret);
+
        lock_sock(&rx->sk);
 
        if (!key)