summary refs log tree commit diff
path: root/net/rxrpc/ar-input.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2016-03-04 15:56:06 +0000
committerDavid Howells <dhowells@redhat.com>2016-03-04 15:56:06 +0000
commit351c1e648623b742fe1687636117306adc8b561c (patch)
tree483d1630ed4dc47d80ed77bcd266eac81dea1ce2 /net/rxrpc/ar-input.c
parentee6fe085a992d40d2b5d3e7e2b9e0eec1cdacaac (diff)
downloadlinux-351c1e648623b742fe1687636117306adc8b561c.tar.gz
rxrpc: Be more selective about the types of received packets we accept
Currently, received RxRPC packets outside the range 1-13 are rejected.
There are, however, holes in the range that should also be rejected - plus
at least one type we don't yet support - so reject these also.

Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net/rxrpc/ar-input.c')
-rw-r--r--net/rxrpc/ar-input.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/rxrpc/ar-input.c b/net/rxrpc/ar-input.c
index e6396a8c969f..63ed75c40e29 100644
--- a/net/rxrpc/ar-input.c
+++ b/net/rxrpc/ar-input.c
@@ -728,7 +728,8 @@ void rxrpc_data_ready(struct sock *sk)
 	     sp->hdr.flags & RXRPC_CLIENT_INITIATED ? "ToServer" : "ToClient",
 	     sp->hdr.epoch, sp->hdr.cid, sp->hdr.callNumber);
 
-	if (sp->hdr.type == 0 || sp->hdr.type >= RXRPC_N_PACKET_TYPES) {
+	if (sp->hdr.type >= RXRPC_N_PACKET_TYPES ||
+	    !((RXRPC_SUPPORTED_PACKET_TYPES >> sp->hdr.type) & 1)) {
 		_proto("Rx Bad Packet Type %u", sp->hdr.type);
 		goto bad_message;
 	}