Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2285056ybl; Thu, 19 Dec 2019 11:01:11 -0800 (PST) X-Google-Smtp-Source: APXvYqwQlE6wO2+XKUQ7X5caB8b4gnaaLcthY8mUsmlIpYUyNyfCOSkI+6M2fvZ6nrEFv4dWwkkl X-Received: by 2002:a9d:7448:: with SMTP id p8mr353361otk.96.1576782070915; Thu, 19 Dec 2019 11:01:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576782070; cv=none; d=google.com; s=arc-20160816; b=FglTkQ7703Ip18UMdX9dT6kv2oQMkdZYvsPeNkFC8pLCfNG0206DIff7DgETCcriUW deFmBWXNA5lw+sTsrdk8pK3YFXEUoLjfLuQu/S5frnhAli8I+MnUbvswzAhuq9HAN6wa hp9FhzZLhtFpxFo5fc48PdE/qFyt9rN0gAazbumPyLuZAde5z37060myxK82M/Qk5KsN MHs+qG+qaBFI7V8736fDe0D1YlFp3HMNrgAWqgAEOv4hbtXjZLuvZJlpA5IaZ6oLz4Hc qKEoYf55Rmf8N5SJ6IoCNhJLdo061JA9XKRX06g3j261lnEDPx41pDPjPxazERVFqYVw 1+HA== 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=NzcxzOeOHUvklOA5juMoNuCunjODzw9qRW1MzH3XjiI=; b=VoYP3ZT+6dPPThp6h7oNea5TTuk0Dq56HPh5jvHs5mSf5z/I122tJDE/BjJc6XWJJV czAi2nFTCKZJX9//9tvdkJuPRbC7xz41HjhLqIZPItBAc5IC07GEF3pnjFOTqRCnQLU4 t9X7foSeYhCDJzY9AaYoLICLrQB8DYwXObN0UN6ininK2tSmzKxl7j2BFfbEFhY41hJU XvCVf5lPuxZzT/D2ml4j5wvwa0sXzhQU0EQMcg2hsdm28mACtVeB62rANCcpg30Hns9J Kvw0PE7HBsTWkGsUeolJu1RBWICLLq7o1bwPhoLIjdnw7x4grdo8BkEU2p5pX2YREdKm ukhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BRUq+m3t; 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 i10si3932844otk.195.2019.12.19.11.00.58; Thu, 19 Dec 2019 11:01:10 -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=BRUq+m3t; 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 S1730283AbfLSS6z (ORCPT + 99 others); Thu, 19 Dec 2019 13:58:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:49578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730146AbfLSSyM (ORCPT ); Thu, 19 Dec 2019 13:54:12 -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 06E1B2465E; Thu, 19 Dec 2019 18:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576781651; bh=S/9+xWGmWDXPr3s3nImnrjBM7AWKWG9skAhDeJV1tWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BRUq+m3tzdRV1Ozygmyxmsplap4YImdkWRspOtaxzP8bxqhl1RbfVQ5n2vK+DWJf4 xl3FLjKKedorWSjXhOWYqjiAvTyv3wONQtsIGx26Rpg4eDnlLnfWhlf7TPYq9XxXTi Njawrm/nG6Z4vOOCOHNMs0UexEYCH6tGud9D+MlY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Chris Lew , Bjorn Andersson Subject: [PATCH 5.4 24/80] rpmsg: glink: Put an extra reference during cleanup Date: Thu, 19 Dec 2019 19:34:16 +0100 Message-Id: <20191219183102.112015951@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: Chris Lew commit b646293e272816dd0719529dcebbd659de0722f7 upstream. 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 Signed-off-by: Greg Kroah-Hartman --- drivers/rpmsg/qcom_glink_native.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1641,6 +1641,10 @@ void qcom_glink_native_remove(struct qco 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);