Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2280067ybl; Thu, 19 Dec 2019 10:56:22 -0800 (PST) X-Google-Smtp-Source: APXvYqxN0jkccesY3w+ysM50uvKEI622K+VJAf7S3yD+G7ENnZJjy4gWZrECwt6J9W4qfK3IZRsf X-Received: by 2002:a05:6830:1d7a:: with SMTP id l26mr9954424oti.138.1576781782527; Thu, 19 Dec 2019 10:56:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576781782; cv=none; d=google.com; s=arc-20160816; b=CM5TLadvB9szuVyuco9RAnmkkdFrhtCMm9QegJVVtSw/5b1wFUybmBezYTwQMBTE/w AFJr1JfdbRtza4S0tLWmN8aTXY4iYBVEf0AKYDc4a7ZHNBBnX/AmwGLEFN3U4Rq9de7R PsCi5R7BnJZ4Frc7Qdw1w49WTTHu5Zndb5WOhC6q6AJJJg6so8M66Sq0EUQSTp8M5sTX EjIxEPL9GVgu6OPGdimCv9tpIf3ukIWi4IVsIgMMTndxGkJW5vTUqLXQqYORK64K/9jb rXGcZfxkhMJp4YtOYtC9NG0tyJzWdobffoy6FFOWGgb0UxmZoB29CqB9HunnROMGS3RD zk0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jlvdr3mvVo991JtkD+UyLyR1G5zJ5ZY8TDXQ0NiQtmE=; b=NAiK1hsyFs2XQkK79nDSsGdCCmlEnwc5jFkICDEkS4pNZ0eQQjxE1Ybq9bCgqwq5kL 5fvv3GA8qXC0jMa9LWyZGVtfHa/Gp5UA58v9AQrSuiNEjgVj8ExUDJpV/ZR1lOpOs4Ju UoatHOmpdbSLPw+PsoOrOSSLfyiVNE4GIiVCungZZ49xXkczUUL02GLAVF+UfC1EmaS9 QpOkQuX5QBdyiEeSUKlTH4/xSMhSolkJE7t3qne32uyAKi2uNc12TEOd5JRQNmrgkDmK eEsgu+2tYRH4pkTu3TNmnp0Ogrpows9rQJzbr7VmjnYGhLuRH0LQ9t3tSLWIzQH9ZxM2 hpiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=An3WehkW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10si3466980oia.232.2019.12.19.10.56.10; Thu, 19 Dec 2019 10:56:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=An3WehkW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730264AbfLSSyX (ORCPT + 99 others); Thu, 19 Dec 2019 13:54:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:49720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730485AbfLSSyT (ORCPT ); Thu, 19 Dec 2019 13:54:19 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 401C3222C2; Thu, 19 Dec 2019 18:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576781658; bh=cbwsBuEqEqia5+bAaY56n4OPjROO8sIYdADYQJI11w0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=An3WehkWnTED1GxJzspdCWxJrj5a8w4zY3ifbpVmDUsXXfas/SCLJjSa4w5tvfjna dShkC90AjvU8JlGPDdQkKPT6jCT6QDmowVuqt0JztWJt6x/ZnLbETHKqLZCRTZaauc uUWBhDv92TwCs+/ZUEOmULmkpMFnq36t0RsOxGwQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Lew , Srinivas Kandagatla , Bjorn Andersson Subject: [PATCH 5.4 27/80] rpmsg: glink: Free pending deferred work on remove Date: Thu, 19 Dec 2019 19:34:19 +0100 Message-Id: <20191219183103.008476749@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183031.278083125@linuxfoundation.org> References: <20191219183031.278083125@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Andersson commit 278bcb7300f61785dba63840bd2a8cf79f14554c upstream. By just cancelling the deferred rx worker during GLINK instance teardown any pending deferred commands are leaked, so free them. Fixes: b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver") Cc: stable@vger.kernel.org Acked-by: Chris Lew Tested-by: Srinivas Kandagatla Signed-off-by: Bjorn Andersson Signed-off-by: Greg Kroah-Hartman --- drivers/rpmsg/qcom_glink_native.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1562,6 +1562,18 @@ static void qcom_glink_work(struct work_ } } +static void qcom_glink_cancel_rx_work(struct qcom_glink *glink) +{ + struct glink_defer_cmd *dcmd; + struct glink_defer_cmd *tmp; + + /* cancel any pending deferred rx_work */ + cancel_work_sync(&glink->rx_work); + + list_for_each_entry_safe(dcmd, tmp, &glink->rx_queue, node) + kfree(dcmd); +} + struct qcom_glink *qcom_glink_native_probe(struct device *dev, unsigned long features, struct qcom_glink_pipe *rx, @@ -1639,7 +1651,7 @@ void qcom_glink_native_remove(struct qco int ret; disable_irq(glink->irq); - cancel_work_sync(&glink->rx_work); + qcom_glink_cancel_rx_work(glink); ret = device_for_each_child(glink->dev, NULL, qcom_glink_remove_device); if (ret)