From patchwork Fri Oct 4 22:26:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 175254 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1307572ill; Fri, 4 Oct 2019 15:27:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGK/nHTd5tGDlEMrGnw45uPwqL4SYDk3oNe3fDBy9i1S1+aY3FREr9I8s6MA4BSHe6b6+p X-Received: by 2002:a17:906:e0d1:: with SMTP id gl17mr13925266ejb.99.1570228063555; Fri, 04 Oct 2019 15:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570228063; cv=none; d=google.com; s=arc-20160816; b=wVNQa9Sz4MFC6TOXJAIQNOO5cHYWabPa4/meQlK6/7UK8JPS5OSxGyrOVZ+qPE9pG3 mbXdzP8M9Yfc6JQQi9v1V880vVGOytirTsiUcQ6ih516VJfJTxiyhNjFzf0LlkAWpHc6 zJoR6+/vMUkLM7RkGXxvoilQ99EmDUVL9nLaCYO9hCu3GkrGxwym62DVJOhi6LWO6umY ztzh4D3CmXECJ/4ObEviomyoHgoCFUg7LpU28X/Wu55AM8lGy0yX8QeSqVnaXUxzgTvC VHDXXyZjZvT0rRX7KzGd50XsKXYPXWBEh73ozPlr1L7M4/VJUS+yqqMJxoUpDFCHoq8o ONAA== 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 e14si4510535eda.104.2019.10.04.15.27.43; Fri, 04 Oct 2019 15:27:43 -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 S2388888AbfJDW1m (ORCPT + 27 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(+) -- 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);