Skip to contentSkip to conversation

net: qrtr: Stop rx_worker before freeing node

PATCH Applied Bjorn Andersson 2 participants 2 messages Sep 18, 2019 – Sep 22, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: qrtr: Stop rx_worker before freeing node

As the endpoint is unregistered there might still be work pending to handle incoming messages, which will result in a use after free scenario. The plan is to remove the rx_worker, but until then (and for stable@) ensure that the work is stopped before the node is freed.

Fixes bdabad3e363d ("net: Add Qualcomm IPC router")
---
 net/qrtr/qrtr.c | 1 +
 1 file changed, 1 insertion(+)
net/qrtr/qrtr.c +1 -0
index 6c8b0f6d28f9..88f98f27ad88 100644
@@ -150,6 +150,7 @@ static void __qrtr_node_release(struct kref *kref)
 	list_del(&node->item);
 	mutex_unlock(&qrtr_node_lock);
 
+	cancel_work_sync(&node->work);
 	skb_queue_purge(&node->rx_queue);
 	kfree(node);
 }
Signature · 1 line
2.18.0
#1 lore raw
Quoted 8 lines · Bjorn Andersson

As the endpoint is unregistered there might still be work pending to handle incoming messages, which will result in a use after free scenario. The plan is to remove the rx_worker, but until then (and for stable@) ensure that the work is stopped before the node is freed.

Fixes bdabad3e363d ("net: Add Qualcomm IPC router")

Thanks! Applied, and queued for 4.9+.

FWIW Dave handles the stable submission himself, so no need to CC stable on networking patches:
https://www.kernel.org/doc/html/latest/networking/netdev-FAQ.html#q-i-see-a-network-patch-and-i-think-it-should-be-backported-to-stable