summaryrefslogtreecommitdiff
path: root/net/rxrpc/conn_service.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/rxrpc/conn_service.c')
-rw-r--r--net/rxrpc/conn_service.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/net/rxrpc/conn_service.c b/net/rxrpc/conn_service.c
index cdcac50cd1a8..a42b210c40a5 100644
--- a/net/rxrpc/conn_service.c
+++ b/net/rxrpc/conn_service.c
@@ -16,17 +16,24 @@
* get a record of an incoming connection
*/
struct rxrpc_connection *rxrpc_incoming_connection(struct rxrpc_local *local,
- struct rxrpc_peer *peer,
+ struct sockaddr_rxrpc *srx,
struct sk_buff *skb)
{
struct rxrpc_connection *conn, *candidate = NULL;
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
+ struct rxrpc_peer *peer;
struct rb_node *p, **pp;
const char *new = "old";
u32 epoch, cid;
_enter("");
+ peer = rxrpc_lookup_peer(local, srx, GFP_NOIO);
+ if (!peer) {
+ _debug("no peer");
+ return ERR_PTR(-EBUSY);
+ }
+
ASSERT(sp->hdr.flags & RXRPC_CLIENT_INITIATED);
epoch = sp->hdr.epoch;
@@ -58,6 +65,7 @@ struct rxrpc_connection *rxrpc_incoming_connection(struct rxrpc_local *local,
* redo the search */
candidate = rxrpc_alloc_connection(GFP_NOIO);
if (!candidate) {
+ rxrpc_put_peer(peer);
_leave(" = -ENOMEM");
return ERR_PTR(-ENOMEM);
}
@@ -114,6 +122,7 @@ struct rxrpc_connection *rxrpc_incoming_connection(struct rxrpc_local *local,
success:
_net("CONNECTION %s %d {%x}", new, conn->debug_id, conn->proto.cid);
+ rxrpc_put_peer(peer);
_leave(" = %p {u=%d}", conn, atomic_read(&conn->usage));
return conn;