From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 767CA189505; Tue, 30 Jul 2024 16:10:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722355806; cv=none; b=KofS22lj5xtDRSIwnPuy7ScSXXlZymMDiESFxX6NpsKd5p+llMdzDeldMpphJsS5tK005enXTniy+aGfU1ORmw4UXueqD7FVmpsib82PpqZsCNpKnkzLVRoQDgGLOJf9ixeE0bYB3upJ9SQomLDhbhfXGNNE/EIEQXaqKXLUlmA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722355806; c=relaxed/simple; bh=fA0JU0Jkkfc1y2TGd58ONug8RLfLIZqtvGGnIsRUtZw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JNjP1xNxRuKqM22sFbXmFhZo6z9Q2L/9WwM+9C355E6IoXit8YtxTkP0FkXj2eSWkBZZlvAtk/kJDo1kx1YH4oMJa5EB2JgotBdwm3A3wHwTC9/4CP45Q2puzKrCzQXwpJstBXge5Cc13LVjcROzorwf0jcQSMBqj92wCYwI1o4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=S8jDB4gc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="S8jDB4gc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB7F4C32782; Tue, 30 Jul 2024 16:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1722355806; bh=fA0JU0Jkkfc1y2TGd58ONug8RLfLIZqtvGGnIsRUtZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S8jDB4gca9/ACmZAvw+7nO8ZAcTuZ3gGwoe/AI0AkK8lHRqPc4K+M/TLSGngYh9H2 wx3dFIzPBIiLjraJUySiPCV7z7h1FhrHEa51htCO/rR4GRk/PfDs2JW7ZMOjcSnn78 B1Dxhovxl2Pw6nhCd6EwzDXLCXr1Y3HFInCiAxC8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Steev Klimaszewski , Alexey Minnekhanov , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin , Neil Armstrong Subject: [PATCH 6.10 090/809] soc: qcom: pdr: protect locator_addr with the main mutex Date: Tue, 30 Jul 2024 17:39:26 +0200 Message-ID: <20240730151728.192455524@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730151724.637682316@linuxfoundation.org> References: <20240730151724.637682316@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Baryshkov [ Upstream commit 107924c14e3ddd85119ca43c26a4ee1056fa9b84 ] If the service locator server is restarted fast enough, the PDR can rewrite locator_addr fields concurrently. Protect them by placing modification of those fields under the main pdr->lock. Fixes: fbe639b44a82 ("soc: qcom: Introduce Protection Domain Restart helpers") Tested-by: Neil Armstrong # on SM8550-QRD Tested-by: Steev Klimaszewski Tested-by: Alexey Minnekhanov Signed-off-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20240622-qcom-pd-mapper-v9-1-a84ee3591c8e@linaro.org Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- drivers/soc/qcom/pdr_interface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/soc/qcom/pdr_interface.c b/drivers/soc/qcom/pdr_interface.c index a1b6a4081dea7..76a62c2ecc58a 100644 --- a/drivers/soc/qcom/pdr_interface.c +++ b/drivers/soc/qcom/pdr_interface.c @@ -76,12 +76,12 @@ static int pdr_locator_new_server(struct qmi_handle *qmi, locator_hdl); struct pdr_service *pds; + mutex_lock(&pdr->lock); /* Create a local client port for QMI communication */ pdr->locator_addr.sq_family = AF_QIPCRTR; pdr->locator_addr.sq_node = svc->node; pdr->locator_addr.sq_port = svc->port; - mutex_lock(&pdr->lock); pdr->locator_init_complete = true; mutex_unlock(&pdr->lock); @@ -104,10 +104,10 @@ static void pdr_locator_del_server(struct qmi_handle *qmi, mutex_lock(&pdr->lock); pdr->locator_init_complete = false; - mutex_unlock(&pdr->lock); pdr->locator_addr.sq_node = 0; pdr->locator_addr.sq_port = 0; + mutex_unlock(&pdr->lock); } static const struct qmi_ops pdr_locator_ops = { @@ -365,12 +365,14 @@ static int pdr_get_domain_list(struct servreg_get_domain_list_req *req, if (ret < 0) return ret; + mutex_lock(&pdr->lock); ret = qmi_send_request(&pdr->locator_hdl, &pdr->locator_addr, &txn, SERVREG_GET_DOMAIN_LIST_REQ, SERVREG_GET_DOMAIN_LIST_REQ_MAX_LEN, servreg_get_domain_list_req_ei, req); + mutex_unlock(&pdr->lock); if (ret < 0) { qmi_txn_cancel(&txn); return ret; -- 2.43.0