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

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

rxrpc: Make service connection lookup always check for retry



When an RxRPC service packet comes in, the target connection is looked up
by an rb-tree search under RCU and a read-locked seqlock; the seqlock retry
check is, however, currently skipped if we got a match, but probably
shouldn't be in case the connection we found gets replaced whilst we're
doing a search.

Make the lookup procedure always go through need_seqretry(), even if the
lookup was successful.  This makes sure we always pick up on a write-lock
event.

On the other hand, since we don't take a ref on the object, but rely on RCU
to prevent its destruction after dropping the seqlock, I'm not sure this is
necessary.

Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5e369aef
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -50,12 +50,11 @@ struct rxrpc_connection *rxrpc_find_service_conn_rcu(struct rxrpc_peer *peer,
			else if (conn->proto.index_key > k.index_key)
			else if (conn->proto.index_key > k.index_key)
				p = rcu_dereference_raw(p->rb_right);
				p = rcu_dereference_raw(p->rb_right);
			else
			else
				goto done;
				break;
			conn = NULL;
			conn = NULL;
		}
		}
	} while (need_seqretry(&peer->service_conn_lock, seq));
	} while (need_seqretry(&peer->service_conn_lock, seq));


done:
	done_seqretry(&peer->service_conn_lock, seq);
	done_seqretry(&peer->service_conn_lock, seq);
	_leave(" = %d", conn ? conn->debug_id : -1);
	_leave(" = %d", conn ? conn->debug_id : -1);
	return conn;
	return conn;