aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2016-03-04 10:56:06 -0500
committerDavid Howells <dhowells@redhat.com>2016-03-04 10:56:06 -0500
commit351c1e648623b742fe1687636117306adc8b561c (patch)
tree483d1630ed4dc47d80ed77bcd266eac81dea1ce2
parentee6fe085a992d40d2b5d3e7e2b9e0eec1cdacaac (diff)
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>
-rw-r--r--include/rxrpc/packet.h11
-rw-r--r--net/rxrpc/ar-input.c3
2 files changed, 13 insertions, 1 deletions
diff --git a/include/rxrpc/packet.h b/include/rxrpc/packet.h
index de1e67988ada..9ebab3a8cf0a 100644
--- a/include/rxrpc/packet.h
+++ b/include/rxrpc/packet.h
@@ -70,6 +70,17 @@ struct rxrpc_wire_header {
70 70
71extern const char *rxrpc_pkts[]; 71extern const char *rxrpc_pkts[];
72 72
73#define RXRPC_SUPPORTED_PACKET_TYPES ( \
74 (1 << RXRPC_PACKET_TYPE_DATA) | \
75 (1 << RXRPC_PACKET_TYPE_ACK) | \
76 (1 << RXRPC_PACKET_TYPE_BUSY) | \
77 (1 << RXRPC_PACKET_TYPE_ABORT) | \
78 (1 << RXRPC_PACKET_TYPE_ACKALL) | \
79 (1 << RXRPC_PACKET_TYPE_CHALLENGE) | \
80 (1 << RXRPC_PACKET_TYPE_RESPONSE) | \
81 /*(1 << RXRPC_PACKET_TYPE_DEBUG) | */ \
82 (1 << RXRPC_PACKET_TYPE_VERSION))
83
73/*****************************************************************************/ 84/*****************************************************************************/
74/* 85/*
75 * jumbo packet secondary header 86 * jumbo packet secondary header
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)
728 sp->hdr.flags & RXRPC_CLIENT_INITIATED ? "ToServer" : "ToClient", 728 sp->hdr.flags & RXRPC_CLIENT_INITIATED ? "ToServer" : "ToClient",
729 sp->hdr.epoch, sp->hdr.cid, sp->hdr.callNumber); 729 sp->hdr.epoch, sp->hdr.cid, sp->hdr.callNumber);
730 730
731 if (sp->hdr.type == 0 || sp->hdr.type >= RXRPC_N_PACKET_TYPES) { 731 if (sp->hdr.type >= RXRPC_N_PACKET_TYPES ||
732 !((RXRPC_SUPPORTED_PACKET_TYPES >> sp->hdr.type) & 1)) {
732 _proto("Rx Bad Packet Type %u", sp->hdr.type); 733 _proto("Rx Bad Packet Type %u", sp->hdr.type);
733 goto bad_message; 734 goto bad_message;
734 } 735 }