Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1428629

[PATCH net-next 09/14] rxrpc: Validate the net address given to rxrpc_kernel_begin_call()

From David Howells <dhowells@redhat.com>
Newsgroups linux.kernel
Subject [PATCH net-next 09/14] rxrpc: Validate the net address given to rxrpc_kernel_begin_call()
Date 2016-06-22 12:00 +0200
Message-ID <rMN6W-1Ju-35@gated-at.bofh.it> (permalink)
References <rMN6V-1Ju-3@gated-at.bofh.it>
Organization Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903

Show all headers | View raw


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 |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index 408bd024125b..b29bb50af5de 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -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)

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 00/14] rxrpc: Get rid of conn bundle and transport  structs  David Howells <dhowells@redhat.com> - 2016-06-22 12:00 +0200
  [PATCH net-next 13/14] rxrpc: Kill the client connection bundle  concept David Howells <dhowells@redhat.com> - 2016-06-22 12:00 +0200
  [PATCH net-next 12/14] rxrpc: Provide more refcount helper functions David Howells <dhowells@redhat.com> - 2016-06-22 12:00 +0200
  [PATCH net-next 09/14] rxrpc: Validate the net address given to  rxrpc_kernel_begin_call() David Howells <dhowells@redhat.com> - 2016-06-22 12:00 +0200
  [PATCH net-next 02/14] rxrpc: fix uninitialized variable use David Howells <dhowells@redhat.com> - 2016-06-22 12:00 +0200
  [PATCH net-next 14/14] rxrpc: Kill off the rxrpc_transport struct David Howells <dhowells@redhat.com> - 2016-06-22 12:00 +0200
  Re: [PATCH net-next 00/14] rxrpc: Get rid of conn bundle and transport structs  David Howells <dhowells@redhat.com> - 2016-06-22 12:10 +0200

csiph-web