@@ -418,12 +418,20 @@ static struct qrtr_node *qrtr_node_lookup(unsigned int nid)
static void qrtr_node_assign(struct qrtr_node *node, unsigned int nid)
{
unsigned long flags;
+ unsigned long key;
if (nid == QRTR_EP_NID_AUTO)
return;
spin_lock_irqsave(&qrtr_nodes_lock, flags);
- radix_tree_insert(&qrtr_nodes, nid, node);
+
+ /* Always insert with the endpoint_id + node_id */
+ key = (unsigned long)node->ep->id << 32 | nid;
+ radix_tree_insert(&qrtr_nodes, key, node);
+
+ if (!radix_tree_lookup(&qrtr_nodes, nid))
+ radix_tree_insert(&qrtr_nodes, nid, node);
+
if (node->nid == QRTR_EP_NID_AUTO)
node->nid = nid;
spin_unlock_irqrestore(&qrtr_nodes_lock, flags);