netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: qrtr: Stop rx_worker before freeing node
@ 2019-09-18 17:21 Bjorn Andersson
  2019-09-22  1:54 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Bjorn Andersson @ 2019-09-18 17:21 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, linux-kernel, linux-arm-msm, Srinivas Kandagatla, stable

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")
Cc: stable@vger.kernel.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 net/qrtr/qrtr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 6c8b0f6d28f9..88f98f27ad88 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -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);
 }
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: qrtr: Stop rx_worker before freeing node
  2019-09-18 17:21 [PATCH] net: qrtr: Stop rx_worker before freeing node Bjorn Andersson
@ 2019-09-22  1:54 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2019-09-22  1:54 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: David S. Miller, netdev, linux-kernel, linux-arm-msm,
	Srinivas Kandagatla, stable

On Wed, 18 Sep 2019 10:21:17 -0700, Bjorn Andersson wrote:
> 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")
> Cc: stable@vger.kernel.org
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-22  1:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-18 17:21 [PATCH] net: qrtr: Stop rx_worker before freeing node Bjorn Andersson
2019-09-22  1:54 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).