net: qrtr: Stop rx_worker before freeing node
authorBjorn Andersson <bjorn.andersson@linaro.org>
Wed, 18 Sep 2019 17:21:17 +0000 (10:21 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 10:47:40 +0000 (12:47 +0200)
[ Upstream commit 73f0c11d11329a0d6d205d4312b6e5d2512af7c5 ]

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>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/qrtr/qrtr.c

index 084adea6a81886e4e16f6e32ffeb869abd7c4d2e..8d9a244f453434176da6a2d4c8c220e69127350a 100644 (file)
@@ -129,6 +129,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);
 }