Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1466845ybp; Fri, 4 Oct 2019 15:31:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGiOh2Ynul7dBXxzuE/l2yWXOIy4WPrY8W/0jaww/5uUi4zJrmdfrRvSqVARdhFzQyi+X+ X-Received: by 2002:a50:9625:: with SMTP id y34mr17468475eda.72.1570228276797; Fri, 04 Oct 2019 15:31:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570228276; cv=none; d=google.com; s=arc-20160816; b=lcWS0EHV1FzvOn5rC6+HLby/e/CezOyvUHwCzkLCMfn+Q+TH3LWAJki5JgebUA9xsi y9fnNCyXPidmhUasJBxPBeCnBQP6CK0iahkpjNdp0qGGj/p/9oUtFGbCFMXqecelwNwj SrUFJjuNGm0Rt/1Wm0oE4YSpyrDJmEXl9KGUYp/ImpsL+eex36m3XkRQYqfbMF00QiFs 5+4lJuIeiexV9gIzeK90WO0Z4xgrMJLfnCAmHqxbAjRzBITuX1+Xw1mZoLuXVPevhOYl 4qxgQd+sMa1s/zgBgbtbxQqmw5ASDQNWyQ5bvFmqhEZVRdT77aSmz/mBQYVAsO4fzJw9 G4aQ== 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=tgp/FeB2xBiOrdWqd66mmTH1EYf2q2e7GgKZ4PEeOIY=; b=eDjfYF6yWivOlZk8GdWdgHZi35mUrhehOsA/UpNi6k8vsQMIFm3CtnA5nPK93i7fhP Ke1xQtk85837zvu1wAnjDIUg4OE+IPk9wIBSxE3dZe6SCCLXPib7tOWkYeydsNwFmnBZ n9OTyIfqbUSrVo+UJtaSK1Ze9zGDRc+zxge1YEFFqn8JzE9RM6rQ2UPVLIeWHL8mC7J7 TzZvgK/4waSHhQJEbG9tyCZ1oJaO3FycBMyrpuFxnmdpzOW5b4ZBdudUnyNUgXtSTl1g qrnXnWZZ8FDWrjDwhSgwXeTVH6bvvWUpSBLZA34ojKmLwVW6IWWCOD1mE6vR4m1hjQl2 50lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FHrs101s; 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 j47si4303816ede.117.2019.10.04.15.30.53; Fri, 04 Oct 2019 15:31:16 -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=FHrs101s; 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 S2388866AbfJDW1m (ORCPT + 99 others); Fri, 4 Oct 2019 18:27:42 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:46325 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388195AbfJDW1O (ORCPT ); Fri, 4 Oct 2019 18:27:14 -0400 Received: by mail-pf1-f196.google.com with SMTP id q5so4698898pfg.13 for ; Fri, 04 Oct 2019 15:27:12 -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=tgp/FeB2xBiOrdWqd66mmTH1EYf2q2e7GgKZ4PEeOIY=; b=FHrs101ssw/11oKSgeFbq+imwHggSoDWpMnD0XoJoGXLDG/DMQVKPS1SAt/7Dlb+jH JR4tbGd6OB7SxAvznNvOb94ShM/oM0QF5d8qI5f2T/sYyJsjAE4B4XDsXOPQ6sonOp9D U9zOwol2bbZakyvNAhVndhWwvqwwSPukMSDkCYis8Q3vdYKsMCjl/1pH8gI6VAzTyu5o NNMJaAGpMm1l5ySndZHzAySTeHWF+t2r2lzOfNybRl5Nm/Ltnl3oDjYSpMtPf5tfDbdP sT/kZkxgMZjvR1ShM9y5mC3EjNH5OJ8AZWS7D0ypKcEWw8VsvrIr3K2Snxpyyh2Crwn7 GQNQ== 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=tgp/FeB2xBiOrdWqd66mmTH1EYf2q2e7GgKZ4PEeOIY=; b=E1vNVoK2Tzos+uAiM65AqGtUdlAZ0FkoAcXMgKeUrGf2WoDUgo6hTfITvb32tWvUQP TxSPkzhQKpKl9OQrBPK4h7zBFeGb8dfV2n/vd5eU87Oe+6Vz+lOJvqwdPecWzGAkbm0t Cn01nRUa3vz/qwaCiepYTg3hfYULKCkgQz2R/+eAbWoMDZ+z588iK9koqUkQvCSSBsGr 18Ljs9HUT8IzGNMCpIgZBaA2BEyK2RyJNKzNEY58CViyDD6pKwseRBkY5tDIxjNL9YsI XdwaXcu0/xVA629OPNDdKK/hTqiD9DWOaLRWO0QXVxGQ2K/XxwqIFSABGSS7yiL3BbKc gFPA== X-Gm-Message-State: APjAAAVrMmADi3dvU1Go+Te0E6Mot0C6iq+DgNjzkHWZSpJJyekHFRgs 331Az9HsBySOkmmEK7M0hYGDjA== X-Received: by 2002:aa7:9210:: with SMTP id 16mr19733167pfo.19.1570228032393; Fri, 04 Oct 2019 15:27:12 -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.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Oct 2019 15:27:11 -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 3/6] rpmsg: glink: Put an extra reference during cleanup Date: Fri, 4 Oct 2019 15:26:59 -0700 Message-Id: <20191004222702.8632-4-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 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 Tested-by: Srinivas Kandagatla Signed-off-by: Chris Lew Reported-by: Srinivas Kandagatla Signed-off-by: Bjorn Andersson --- Changes since v1: - None drivers/rpmsg/qcom_glink_native.c | 4 ++++ 1 file changed, 4 insertions(+) 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); -- 2.18.0