Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2459380lqz; Tue, 2 Apr 2024 20:09:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXnv8KmRcIrn2lGE8Bmfw5WpIbGrRlyAtdxONM0Ryy6TgOnagiEUQtbg+WBOUzEfBaOUyB59wodfJ7aOwrAZr+taQzqwfA1kWKmRlUnfQ== X-Google-Smtp-Source: AGHT+IG0WX3JkAPn9aJBaz6iTx7S11fLqMHwsPwlpSnW4lFzd0orTZDdrVolONMvMe+nCV2+hAvb X-Received: by 2002:a05:6512:3da2:b0:516:af34:6e39 with SMTP id k34-20020a0565123da200b00516af346e39mr5588183lfv.36.1712113740392; Tue, 02 Apr 2024 20:09:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712113740; cv=pass; d=google.com; s=arc-20160816; b=NX+8z8uRo3NtHaZRKdG2VsiDZHkNr7ucbDEgVcOamuv/JWaepKsOrkmH4SpKlAcRsA XDUHckyoBCOinhsv5PkuP3jprIlvksmHpkv0dYD7onXFUdiHeHCNesa5MGjkbO5uFhEM +IKcxClbQsnxBoQXBLIrmQlGuWb4IjNQipe30eybMzH3UrMFJs/D/RGjVCnh1TNn6eQT eNuxf0xinEOcDgGcEjccP9C4SYJ/5Fi7BheTP/N2W1w2Z3HzKoAJhdX6+LiYp4WXILxd LiZ30cY9r2xfczOgY3k/krggn3k3S1eSU16yX+XrKAoRu4O4ztah1bYxf/Sgx1+Ptxf5 tJXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=SLZyQwWsOZDMsjJgKKASz9enfm362tPeU6p67BPPPcA=; fh=iYmr3ABkRuoQrzdIBcCfCCAldxpjKJVIc5aktHDtdxM=; b=FEaBwQJP7ulkaumbh62WgQSIO7MuukZSSknKp40A4+Pk5Cp7ZP1/U4ACeU7R0qj/f9 U2VhBOVgywJ+ejOG7epiaM76PNbTFdMbRGuaz6ekWfSzxYSPzu6dap3LisGgEr6tvrEg B5Lxz4qssGELvayQjoVDD63jJTbIzWULSQ989dR0nV58XLp0H1uDwNDaukEN9mpZcBqN rEXpqIa4b4ttUzFDZJf2jmh5SqlVTLemyyJav93RUcuuOQb90Hf6DIUBcTkbotWk1Dcm AwMCkwmcfiCf4L48CqyJfoTjDekoThm70TWo7E5vPYUZJaqSO4aeAYYIUj4J+vQtw4Fi rXUA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y0Lo2DMB; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-128988-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128988-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f12-20020a17090624cc00b00a4e8d7fca03si1141592ejb.1035.2024.04.02.20.09.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 20:09:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128988-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y0Lo2DMB; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-128988-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128988-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1C1D01F230B3 for ; Wed, 3 Apr 2024 03:09:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B7F11C684; Wed, 3 Apr 2024 03:08:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="y0Lo2DMB" Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 133F61B950 for ; Wed, 3 Apr 2024 03:08:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712113732; cv=none; b=qEXJTjRyfOt1+6af3sDQCwJROALPezEJkJ7ytd5CnPNzplo448oNkLpaZeSsAoJr9nKcfDjnp1B0fSx2wgL6MW2HgDwejT5F262Cjdd6cAzcE4AZ2lA6jLP1+Tm6WZ5/fQz03tBWWl5JCUXdSx1M8GWzYuszenF7p8v1s/9OAW8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712113732; c=relaxed/simple; bh=JNaloNg7IAffGuYznhJyHxVMJLnQeiWsK6eJCMSM1lw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ASKiIHliOdeLjuQWHnXjtCVXzw36hU0MGj3rbkFISYxu1Z1puL8Lzk8FCNYV5aKffoDkdgkRagrM6ZiDp9+1WKE0OuYquJ41EloCaKKbnQvgKRiUlZ1FVg+wHoGJfUQgpsHBduQ0vPAK7K7tg2kw2/KzZcxtIHvSuIL107nqT2Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=y0Lo2DMB; arc=none smtp.client-ip=209.85.219.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-dc6dcd9124bso5538562276.1 for ; Tue, 02 Apr 2024 20:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712113730; x=1712718530; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=SLZyQwWsOZDMsjJgKKASz9enfm362tPeU6p67BPPPcA=; b=y0Lo2DMB+RHXQVqn5l7qJxzM67eEoMfTLlb8T1sKG+VsZRT49biWUCwWcKYdTK/v1+ KswUEa+ylsVuyX8/kIVx2YVmOnqKfuBl1IOBWMZ9FIUriAQA+7IL5bFtSKqUZqxdl1Cp yBFV5I6z9Qm6AA6jY4pCQVc/KkNRxhypaB9y4M5WzaZo+Vx+adB3KhqviG8f1Wh6r+Kc b0Q4IMrLTkU+qM9pifGelxuv/+UZtugrL33sRTxUPHWkqFurxBF6YK3fOKLK2i4eGUNn FBjrI30NzO+bSXsNXFg+OZLbTAjOOSN1cwKFtFrvo0py+KnDANtLpQRtUiOtnHa2RQpb baqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712113730; x=1712718530; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SLZyQwWsOZDMsjJgKKASz9enfm362tPeU6p67BPPPcA=; b=SGR9VLE+PhbfZsaZNiczXO2OlQVxZ+2NxyCVaRvyDNwHz+R6bhrVK/GdNFXrhGvXgZ BdjogmajEesUtR4ZPVc51jbr8A78l49lUANGwDT2XSOhXp3RjSjnNLNFgCA7E1JimUnR Qk3aMW3nkr33WevFVAKrDqDtHOTTDwki/lLSiN+xH3DYaMdptKACeJGbMdR/CccnEwll p2pFkQQvNV72ciZMRLVGSmincAnOwl8RkoPfGswx0BHocv6/+1ewXcRvbnpS25aAqG8e Nb7KOlK9UUaDcQrjQKy6cE6XStC/Rp3KyS5/bc/f4xZtS14e8e9iNm3Y/A12cv7AAE6i obZw== X-Forwarded-Encrypted: i=1; AJvYcCXxoptrzG74fQA0tJXNYb6axrJTaKKjLuO5hQ+t4NbcnEMkq/+xF6OJB5jImSuaPr80bHsVDX2MJmvc1NSbdaNtS2NWCxtNRpvrBBYR X-Gm-Message-State: AOJu0Ywu+YQsaBekJiU1qdWe0ggtmbDRaclPWiFOL5Tqjkz7N19lTTcD EAiLji79SK+HdWVlPDXcACHCzz96gsronAJPn+EP/WcqYruK6S3YTEDNPoPy2vT1V47eMZWNXOD qut6Na8uCl7OLJVCxnzwwet5DUDNo9rtVHGui/Q== X-Received: by 2002:a05:6902:82:b0:dcc:140a:a71f with SMTP id h2-20020a056902008200b00dcc140aa71fmr11987883ybs.60.1712113730070; Tue, 02 Apr 2024 20:08:50 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240402-pmic-glink-fix-clients-v1-0-885440b81c65@linaro.org> <20240402-pmic-glink-fix-clients-v1-1-885440b81c65@linaro.org> In-Reply-To: From: Dmitry Baryshkov Date: Wed, 3 Apr 2024 06:08:38 +0300 Message-ID: Subject: Re: [PATCH 1/2] soc: qcom: pmic_glink: don't traverse clients list without a lock To: Andrew Halaney Cc: Bjorn Andersson , Konrad Dybcio , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Tue, 2 Apr 2024 at 20:56, Andrew Halaney wrote: > > On Tue, Apr 02, 2024 at 08:07:06PM +0300, Dmitry Baryshkov wrote: > > Take the client_lock before traversing the clients list at the > > pmic_glink_state_notify_clients() function. This is required to keep the > > list traversal safe from concurrent modification. > > > > Fixes: 58ef4ece1e41 ("soc: qcom: pmic_glink: Introduce base PMIC GLINK driver") > > Signed-off-by: Dmitry Baryshkov > > --- > > drivers/soc/qcom/pmic_glink.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/soc/qcom/pmic_glink.c b/drivers/soc/qcom/pmic_glink.c > > index f913e9bd57ed..c999358771b3 100644 > > --- a/drivers/soc/qcom/pmic_glink.c > > +++ b/drivers/soc/qcom/pmic_glink.c > > @@ -168,8 +168,10 @@ static void pmic_glink_state_notify_clients(struct pmic_glink *pg) > > } > > Does pmic_glink_rpmsg_callback() deserve similar locking when traversing > the clients list? True. Will fix in v2. > > > > > if (new_state != pg->client_state) { > > + mutex_lock(&pg->client_lock); > > list_for_each_entry(client, &pg->clients, node) > > client->pdr_notify(client->priv, new_state); > > + mutex_unlock(&pg->client_lock); > > pg->client_state = new_state; > > } > > } > > > > -- > > 2.39.2 > > > > > -- With best wishes Dmitry