From patchwork Wed Sep 18 17:19:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 173986 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2731881ill; Wed, 18 Sep 2019 10:19:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxsaNWNCVY0TxzE3JozovJs54TDZHdtb7o5AtMtrmKyP31wZZ95dSnhWHE4omF2u3BxpYGq X-Received: by 2002:a17:906:7e56:: with SMTP id z22mr8295189ejr.294.1568827169193; Wed, 18 Sep 2019 10:19:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568827169; cv=none; d=google.com; s=arc-20160816; b=kIarh0ASwsXXc47vIMUYL8iuXdO5o43uKwB0VCXntDPzaMAlajodMShs01QMdmKI2O yomMHzMRMAB4/gH3uJ6ruZOTDW2QOFbczusCShrPflsxB3oNnzB8AnzhKIYtdHEGsdSW /nXwziZhhGGJKBNCx5xmTHIGFb4Kshk+37oqTQkifFtL2I7maP5hzWCq2852suLci10W iq4okWuyz8KwWm2K3xoZuK6WF3uQ7aqhelskv2VyXNScLVfgXkx234qGfmQkPfUfObbm p2Jw51FA9utBQmvttY2bxNfVEt3rVbsWuuH4MPSwrRrvFZ/zXU780QankKyzmdspyBSD 1K9Q== 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=VwSAewYHioEBjS31iqIfRjVrZyDonRdWcj1Y+TfsqH4=; b=P4K7DBDSdCoJ8xq3sBmllLCPHm2FLYxv0EY2bo5z6wNBod8WkjE3gDFDwx7nxGGcTD y5Y84eKaTSyaDE1IVWdSuvNsqDQ2/nj/MrAU/n9XLxZdN1TYiBaOlpkDuParP3CJhxdI SMVgsF0evIM9zi/rBUvhc5KpKLBWKwrsW+XKTtpmewb0HApeb7FgIkz41VNDqgbBSe03 njyATt0A1AxXvowM8Quocih4mmk06lEbemIFjfnkQ4llFM8bVswA32bMKUysR5l69SEU fWsUdIeTY9N7nf93vEGwuDXvgdqFXSz0Lymp4QpHCYMc8ASBkWYFFv9g8ttfqkKP4fqB Mxtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="rO9i/cqL"; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 om23si3416800ejb.194.2019.09.18.10.19.29; Wed, 18 Sep 2019 10:19:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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="rO9i/cqL"; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1732114AbfIRRT0 (ORCPT + 15 others); Wed, 18 Sep 2019 13:19:26 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:36195 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732110AbfIRRTY (ORCPT ); Wed, 18 Sep 2019 13:19:24 -0400 Received: by mail-pf1-f194.google.com with SMTP id y22so426265pfr.3 for ; Wed, 18 Sep 2019 10:19:24 -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=VwSAewYHioEBjS31iqIfRjVrZyDonRdWcj1Y+TfsqH4=; b=rO9i/cqLekYgyKdKCnFYjAL4R/QkPCECSyUyb7g2A+JKQKpKGHGHs2JQa91AMbG/2w 1lED6OUbgkoFnKNsS8sAuVKoGcJ/HX7iMbXflFVJP+G0Eoh2jir2EAjBir/87kMiVIbH TGN86ho4VviITmkJju5fHnGtLVyX20eLopp2OR9zx/XrG+lbFUgF9ho8nWFvUVmMOosg ztCiiJk0oz5dDSW0jP1/X7SxOt1poyhGRX1OYbu824rVveyFMp8Afqmdm2rA7sVRW6qe yIIF8ArmWEbZl7z3D7gYV6yBb+uq9Yj6DuuVk/BKO+JoxTbwTZEfgolB3XIWu87dAOFJ 5AUg== 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=VwSAewYHioEBjS31iqIfRjVrZyDonRdWcj1Y+TfsqH4=; b=IWoQAkG8gdw3faBNO0v4uVMb9rY5Q9Z1G3QKs+id3C/EJDLnHJakdGSv0y4bVYWT73 /DinCKacinTtp1rWpr8DArY6Wskz2wJkD8khP+nf3XYe/QIHkUMegQV1fc+vwlKO57n7 7ewImVMFhwM+/EslzjzUO+nr2+iyaGMSe26OgfvXw+MMYuYpI48Oz2dIa2QYIvLCp2Q5 lOd6jdVXwyId+ypGS/1+KrjPmlyyv6yfIjyIljlPmiYs5hl0RUFYxLl67l4UPOSQrf32 KmNFMI4cqD3iya5R+G11a2yPNErxJY70xiwSakvMwrX2Q1L5HBWUURR9axn8apnS46rX CiQg== X-Gm-Message-State: APjAAAWKGnCBH5BhvuEuXa5jO57+7nxySp8ThOJJIs2BVfZCac/sUe1v j0vMlzLp0Rs8x170BVUIL6Laog== X-Received: by 2002:a65:6557:: with SMTP id a23mr4976164pgw.439.1568827163712; Wed, 18 Sep 2019 10:19:23 -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 y4sm2614981pjn.19.2019.09.18.10.19.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2019 10:19:23 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson , Srinivas Kandagatla , Jorge Ramirez Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 3/6] rpmsg: glink: Put an extra reference during cleanup Date: Wed, 18 Sep 2019 10:19:13 -0700 Message-Id: <20190918171916.4039-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190918171916.4039-1-bjorn.andersson@linaro.org> References: <20190918171916.4039-1-bjorn.andersson@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Chris Lew In a remote processor crash scenario, there is no guarantee the remote processor sent close requests before it went into a bad state. Remove the reference that is normally handled by the close command in the so channel resources can be released. Fixes: b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver") Cc: stable@vger.kernel.org Signed-off-by: Chris Lew Reported-by: Srinivas Kandagatla Signed-off-by: Bjorn Andersson --- drivers/rpmsg/qcom_glink_native.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.18.0 diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 72ed671f5dcd..21fd2ae5f7f1 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1641,6 +1641,10 @@ void qcom_glink_native_remove(struct qcom_glink *glink) idr_for_each_entry(&glink->lcids, channel, cid) kref_put(&channel->refcount, qcom_glink_channel_release); + /* Release any defunct local channels, waiting for close-req */ + idr_for_each_entry(&glink->rcids, channel, cid) + kref_put(&channel->refcount, qcom_glink_channel_release); + idr_destroy(&glink->lcids); idr_destroy(&glink->rcids); spin_unlock_irqrestore(&glink->idr_lock, flags);