Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1464900ybp; Fri, 4 Oct 2019 15:29:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSqYoLNwqN1qhbBhYJqKZNtQ4OC06B3dxdO1/YoQuqeoEzT9iTMooUMMBZdRooO130iWea X-Received: by 2002:a50:d98a:: with SMTP id w10mr17733024edj.276.1570228150290; Fri, 04 Oct 2019 15:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570228150; cv=none; d=google.com; s=arc-20160816; b=RV7Z5sSmkz8erNJeExZHZaj+3FeYaMbN1Qf3jSXo+4allCL/Yr1SD8w37RILEZOXKW S5vpOqmWolBoact02cy530g58NhCRr0+7Ja2NXgsFQ/hH34UZ+oRlKlSC7sy1u38XqpV 1hplddVJD55OeDW+Vlf3ZXCdqFqt27GtIjZx4xGQvE89QtVWcxWDSn8MYXVjy//c/i+9 uOaVBJlaf/8in2QicGvDdCk5yOUpwwVRD76CfecqhwsdkAhmXeq6n9LYXgWaqkoVqp/b gyIhefTOWWU6mWj+a86FeeUgmvJgAYKC0wiyQlG8I/gexIy6xTtBt5KL9Mzrqe9l79UC PCBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=GFLy/0NyLkAXTIQiU1ce2NkpxRNc39jMeEi2th9+Q/o=; b=WMcwZ5Mo3rRsvFtKHUYE9F6x/EdVRxmCD+zdxa+NUgj+tikBhuCkPCcDdINlsix0zV tS5Z8AFgiicCdSnwHEDVt8TnYm/EgH5roytXNqV8EjwYj7B3D1aofVESMIOS4fHXbGV3 8JFB1Hm5cn+b2k5QS1rBtHTi4eH6kb9fmpfbBQxshgL9EFivun3fVBxElu0Tkw7p+nFo Q8hkqfxS7RKuIiaplYRPzk2g9tVzk3INQbI3XXmNzGFXl8JaZ6SRECr/vwpcv3VNO3Jz 86Pp0Sw5yvYohw+M+oePPZd8eGIes2fTCHdZvIjXtISBtXEYx+cw4OgZzOuAAw7TsKKC keLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eMDlZ5C4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id si9si3818681ejb.97.2019.10.04.15.28.40; Fri, 04 Oct 2019 15:29:10 -0700 (PDT) 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=@linaro.org header.s=google header.b=eMDlZ5C4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388780AbfJDW1a (ORCPT + 99 others); Fri, 4 Oct 2019 18:27:30 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:35917 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388456AbfJDW1R (ORCPT ); Fri, 4 Oct 2019 18:27:17 -0400 Received: by mail-pl1-f196.google.com with SMTP id j11so3779769plk.3 for ; Fri, 04 Oct 2019 15:27:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GFLy/0NyLkAXTIQiU1ce2NkpxRNc39jMeEi2th9+Q/o=; b=eMDlZ5C4geR0qxdtOA7FQXHpGKcU764pJI+ckB/wRPRbnEdzquTg+GeL1UgEUsmnk0 jeSsXMD1cn1W6BUxFWgqVS9IbdqQe/yRGbtgFA5kPzZh/c09SFslyvmFKvlSFAtnJUJK yQ/O1ntAwl4AxLX/8GBUDX3qSznBkuf9hy9852LB2Bt34HdrHe1RPEMpTbLBJztA2Rwq Bhkg8N5Ma4UtUDVaOJhBdTy/ZL+CSAMS0Vc4pJggWaKhY/7ZFA229MdQnDpH/vwvWnxs 5BIrmixZiqVBMO3Hcu29/Akw1P2MiGQvNo08ChJ61GndxQw8ivpAbbaUl7S5kVAuMM2a gU0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GFLy/0NyLkAXTIQiU1ce2NkpxRNc39jMeEi2th9+Q/o=; b=qMOW83TvGr0rqOUbiIeC3lo7GgZOrMoMBmHeJnpw/qSAm6UZxzLSh6NiNfCbK1UUp1 7BxGikA9u8DwOzseb7Povx0aCqAMr5Zw2+WSckqHSt44F5QN9+Vcl9AQzT6joz9auh/+ VXfsq4eYiPZ5va3VoAwdmbpCkg4/BhmtzODmr3wzOK1X4o4fZx7yXEW0ugHW0FZ7MaOI elflzdACViXYuVjMa8qa8K+2L6WfUngvD28BNFgmtm+QbGzK+sQ/as+T7ajIV3lGed2S VGmx/ac2NsqbFcanp0d5qdwZcHtwAfbU+CL/7mGycGOzdMjN0OfAgastwCaXcfPpLlC/ YY/g== X-Gm-Message-State: APjAAAX5N4XdSbpDVTGPPqb7aY7VtWEpmKT21hZGCaTVfUVerLnuPHKc S9o7uJeTptjTtlyC/oOzYjbLf5+wfVo= X-Received: by 2002:a17:902:d916:: with SMTP id c22mr17525848plz.101.1570228036266; Fri, 04 Oct 2019 15:27:16 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id x37sm6328136pgl.18.2019.10.04.15.27.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Oct 2019 15:27:15 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v2 6/6] rpmsg: glink: Free pending deferred work on remove Date: Fri, 4 Oct 2019 15:27:02 -0700 Message-Id: <20191004222702.8632-7-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20191004222702.8632-1-bjorn.andersson@linaro.org> References: <20191004222702.8632-1-bjorn.andersson@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Tested-by: Srinivas Kandagatla Signed-off-by: Bjorn Andersson --- Changes since v1: - None drivers/rpmsg/qcom_glink_native.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 4117818db6a1..862f89c128a0 100644 --- 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_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, @@ -1640,7 +1652,7 @@ void qcom_glink_native_remove(struct qcom_glink *glink) unsigned long flags; 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) -- 2.18.0