Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e0e4d82f authored by David Howells's avatar David Howells Committed by David S. Miller
Browse files

rxrpc: Create a null security type and get rid of conditional calls



Create a null security type for security index 0 and get rid of all
conditional calls to the security operations.  We expect normally to be
using security, so this should be of little negative impact.

Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 648af7fc
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ af-rxrpc-y := \
	ar-security.o \
	ar-skbuff.o \
	ar-transport.o \
	insecure.o \
	misc.o

af-rxrpc-$(CONFIG_PROC_FS) += ar-proc.o
+2 −1
Original line number Diff line number Diff line
@@ -588,7 +588,8 @@ static int rxrpc_process_rx_queue(struct rxrpc_call *call,
		_proto("OOSQ DATA %%%u { #%u }", sp->hdr.serial, sp->hdr.seq);

		/* secured packets must be verified and possibly decrypted */
		if (rxrpc_verify_packet(call, skb, _abort_code) < 0)
		if (call->conn->security->verify_packet(call, skb,
							_abort_code) < 0)
			goto protocol_error;

		rxrpc_insert_oos_packet(call, skb);
+6 −3
Original line number Diff line number Diff line
@@ -207,6 +207,7 @@ static struct rxrpc_connection *rxrpc_alloc_connection(gfp_t gfp)
		INIT_LIST_HEAD(&conn->bundle_link);
		conn->calls = RB_ROOT;
		skb_queue_head_init(&conn->rx_queue);
		conn->security = &rxrpc_no_security;
		rwlock_init(&conn->lock);
		spin_lock_init(&conn->state_lock);
		atomic_set(&conn->usage, 1);
@@ -564,7 +565,6 @@ int rxrpc_connect_call(struct rxrpc_sock *rx,
		     candidate->debug_id, candidate->trans->debug_id);

		rxrpc_assign_connection_id(candidate);
		if (candidate->security)
		candidate->security->prime_packet_security(candidate);

		/* leave the candidate lurking in zombie mode attached to the
@@ -830,7 +830,10 @@ static void rxrpc_destroy_connection(struct rxrpc_connection *conn)
	ASSERT(RB_EMPTY_ROOT(&conn->calls));
	rxrpc_purge_queue(&conn->rx_queue);

	rxrpc_clear_conn_security(conn);
	conn->security->clear(conn);
	key_put(conn->key);
	key_put(conn->server_key);

	rxrpc_put_transport(conn->trans);
	kfree(conn);
	_leave("");
+2 −9
Original line number Diff line number Diff line
@@ -174,15 +174,10 @@ static int rxrpc_process_event(struct rxrpc_connection *conn,
		return -ECONNABORTED;

	case RXRPC_PACKET_TYPE_CHALLENGE:
		if (conn->security)
			return conn->security->respond_to_challenge(
				conn, skb, _abort_code);
		return -EPROTO;
		return conn->security->respond_to_challenge(conn, skb,
							    _abort_code);

	case RXRPC_PACKET_TYPE_RESPONSE:
		if (!conn->security)
			return -EPROTO;

		ret = conn->security->verify_response(conn, skb, _abort_code);
		if (ret < 0)
			return ret;
@@ -238,8 +233,6 @@ static void rxrpc_secure_connection(struct rxrpc_connection *conn)
		}
	}

	ASSERT(conn->security != NULL);

	if (conn->security->issue_challenge(conn) < 0) {
		abort_code = RX_CALL_DEAD;
		ret = -ENOMEM;
+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ static int rxrpc_fast_process_data(struct rxrpc_call *call,

	/* if the packet need security things doing to it, then it goes down
	 * the slow path */
	if (call->conn->security)
	if (call->conn->security_ix)
		goto enqueue_packet;

	sp->call = call;
Loading