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

Commit b113d872 authored by Deepak Kumar Singh's avatar Deepak Kumar Singh Committed by Gerrit - the friendly Code Review server
Browse files

net: qrtr: avoid calling node lookup from rx worker



Acquiring node in rx worker thread results in deadlock when node
release function is called from rx thread which in turn will wait
for rx thread to finish.

No need to acquire node in rx worker thread as node is guaranteed
to be present till the rx thread finishes.

CRs-Fixed: 2579396
Change-Id: I34903b672961e879596b58e28be5e333db5e10d8
Signed-off-by: default avatarDeepak Kumar Singh <deesin@codeaurora.org>
parent 1cedcdb7
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -920,14 +920,12 @@ static bool qrtr_must_forward(struct qrtr_node *src,
	return false;
}

static void qrtr_fwd_ctrl_pkt(struct sk_buff *skb)
static void qrtr_fwd_ctrl_pkt(struct qrtr_node *src, struct sk_buff *skb)
{
	struct qrtr_node *node;
	struct qrtr_node *src;
	struct qrtr_cb *cb = (struct qrtr_cb *)skb->cb;

	qrtr_skb_align_linearize(skb);
	src = qrtr_node_lookup(cb->src_node);
	down_read(&qrtr_node_lock);
	list_for_each_entry(node, &qrtr_all_epts, item) {
		struct sockaddr_qrtr from;
@@ -952,7 +950,6 @@ static void qrtr_fwd_ctrl_pkt(struct sk_buff *skb)
		qrtr_node_enqueue(node, skbn, cb->type, &from, &to, 0);
	}
	up_read(&qrtr_node_lock);
	qrtr_node_release(src);
}

static void qrtr_fwd_pkt(struct sk_buff *skb, struct qrtr_cb *cb)
@@ -988,7 +985,7 @@ static void qrtr_node_rx_work(struct kthread_work *work)
		qrtr_node_assign(node, cb->src_node);

		if (cb->type != QRTR_TYPE_DATA)
			qrtr_fwd_ctrl_pkt(skb);
			qrtr_fwd_ctrl_pkt(node, skb);

		if (cb->type == QRTR_TYPE_NEW_SERVER &&
		    skb->len == sizeof(pkt)) {