Received: by 2002:a05:7208:3003:b0:81:def:69cd with SMTP id f3csp4235161rba; Tue, 2 Apr 2024 10:56:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWItIXErzuStsN0EfHsA6FdwWjEYSuj6Wru67eHZq81t5jVSEBxaz7esAO4WstqOfij7zurny9mVNN9hDjemCYwLC2EwADHIEGXB5pNLg== X-Google-Smtp-Source: AGHT+IEe0yMOOjvRnXKZO0OHj+moh3XJydIK96HrpXuLtir48Nh6i6KOkBZOo2GnstRxvo/S9Sjy X-Received: by 2002:a17:90a:640e:b0:2a2:1903:8727 with SMTP id g14-20020a17090a640e00b002a219038727mr388535pjj.33.1712080610960; Tue, 02 Apr 2024 10:56:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712080610; cv=pass; d=google.com; s=arc-20160816; b=KMGke7ybsuIUSQd7FT7RZuLakB0LNKU8cfXRPdDysD5we4NjOH5jw8KRxcIb1KVSBM YF4HVQfC1EEhcxo/Rcs2OIjlEpmhbwGc+vCMUx82qdH0epM8rPIQVs1nl/DKImOn0lRT 77LLZqJf7jBUEjioKMRgIQezErTAZFzhpq+ljO/4D0Apvil2FedmdBUKHQC2W/euzRN7 EluVj3aOfq6Fi063tr2zcOu0OzkMdsRwbAmHhsOhMzb5yZ10zd0bvjHUrZkdbe/CyhfG QNpkaPcmjlWZ9+5MH4AV04hTWE5rrDzBdRyA+VzZEoMz1CmwyDeDFzh7sh92wopyf5Lf ypKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=LgMPjza/41g8vlyeiXDj0QiyYeEN86lA9UA/Jcby8CQ=; fh=dpd23S+p+AM9zpZ6IGR9b+Trv1gT4WLIGMByBAzj+y0=; b=xFEw8y0LyDr4kr2gtMiqQ+yvYns2ko+qQ/mJrnqtbZs4z5kdIz8OfyZC6e/IQGQPRu fgGVmh24JFdOo0ziB6+9c4Dm0IqmdvJgM9FpDNuw/QiPgacby4rwHbuhZnLlY9E62erB FcPkDXQdHGKT7DFhbF2LIwC9oS3QCgwFXYRnu+ntZlBZ0Kh3Wa9ERf4K3hU4kGX+j6Nh Xssh2RaOjGB0VhgjaGZmaZavAbJb/U45n6yRm9DphVl5cYcjfuQudZ4RR7DO4jd7e+vx SCxFBdlo3lnIOBwRWQmNMgNGW9bnT3E0YDTnFoZfM4M9RwuOsldrIp+Wh9krUGh9jb57 sJfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KCO2dV+z; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-128468-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128468-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id lb14-20020a17090b4a4e00b002a26d9ef56esi958347pjb.66.2024.04.02.10.56.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 10:56:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128468-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KCO2dV+z; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-128468-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128468-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C6AC028486D for ; Tue, 2 Apr 2024 17:56:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5AC5615AAA7; Tue, 2 Apr 2024 17:56:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KCO2dV+z" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 E2D80175A1 for ; Tue, 2 Apr 2024 17:56:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712080599; cv=none; b=qihl88zejRjwzD4R4EfhBMqMstigHlAHR1NDb0JBx7E/gIJoxK1CT0lWYXZZr6+q/tdo2Bt58GR3peksD8L/LEIAOsTp32vMPxxsdoO56xfskISu0581u5gymStlqhlxfJhm1yihQXTwICwQ8WI9FBoDjPc2uL6O5nsks8vyUYY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712080599; c=relaxed/simple; bh=0Y6h6f3cPtEsQDZknsO+IagBdcnjM+3VtzRY1FTs2/8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ArDw3CCnjwKYdysFv596jYbZgQWr/neo7UJppJZIBkDfJGN+7vboINhLh4SA+1D+8mEMydPg6UEJYgVByuflgONoJ5nMw/+T5QBzWLWmqMqAgfqxHm0SopuKbGN1lhMW1fisuIDE8aIiwIpnr+25VwYUeza8MfakuElLJXLvS3Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KCO2dV+z; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712080596; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LgMPjza/41g8vlyeiXDj0QiyYeEN86lA9UA/Jcby8CQ=; b=KCO2dV+ztWjBkl8LiXA0YRS7qCIK/fHpy9mzZI/rD0G6E/huAvAMMo9btpaB4bbjek5Tfh hzVOd58IaEPivIKSE2DHlf+SkpUbRM6xzjt4JfLp3qARxFLMAv9G4PSJnvgeEfkCzNUbci JPHG8DswtycOrMvT7i/qf09brRrh5As= Received: from mail-ua1-f72.google.com (mail-ua1-f72.google.com [209.85.222.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-152-FL2hgjdbPOift-5d2tL_vg-1; Tue, 02 Apr 2024 13:56:35 -0400 X-MC-Unique: FL2hgjdbPOift-5d2tL_vg-1 Received: by mail-ua1-f72.google.com with SMTP id a1e0cc1a2514c-7e05a1de71aso1511309241.1 for ; Tue, 02 Apr 2024 10:56:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712080595; x=1712685395; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LgMPjza/41g8vlyeiXDj0QiyYeEN86lA9UA/Jcby8CQ=; b=mSwjtecyk0ZPOo/XvsFcPukDVwm3BDvgIGNUsTGuq4631wmtpZdjRDB2gjzilMGE8v M9eP2jClwQevY82ym03Fdgbst+JkUqvSzpSMXqCG7fTpQXEfxl68wREQ2AFd8BJNjtU2 iwxZ/3cx7EIfm3VMnC4uHaSqjw4Jp1Y1AbC23dBEVdLFCwjbuhgY/V8tPSK+5Iw8C62c 3C2ejYG5Jwz11VPLBoaXpqMlH6d0MpaANsuix9O5SQ9WM8uUWzJ9MSTbKbbPRl18YE3F j/sgST3Az0Ha4IQC+rgO5Qj6MeXatIxq1KWu5n+1i7y7l7LKyFKBLCwAIkj1hTJqfXNz xeCg== X-Forwarded-Encrypted: i=1; AJvYcCW0xJZJM65aqfrIg9iHWWhxk43ieIyqLPNdD18Sz27Zd1Q0d03ve+IOdGT65032aH0/HXUTXCnmGGH3peGBlZ3SYIzF8SET7vBmXbZ7 X-Gm-Message-State: AOJu0Yxb7EUoq781CkUjKDJxbJyWt+UwEWCzV6WI64fRXGl5sSYEHKm/ bg0fUwvkGhX5J/meF01YVjkwZnjk1u3tSHGVODvAXzIK9kj/+QHIB5UFIS4xX2zOTblITVvDlds q5d2r4exmNKzVLidsFYP//1lyZbFWehBY4vhc91dHjaxNVEN690RGLp1ArUCb7Q== X-Received: by 2002:a05:6102:f99:b0:478:7dd0:7488 with SMTP id e25-20020a0561020f9900b004787dd07488mr727572vsv.4.1712080595027; Tue, 02 Apr 2024 10:56:35 -0700 (PDT) X-Received: by 2002:a05:6102:f99:b0:478:7dd0:7488 with SMTP id e25-20020a0561020f9900b004787dd07488mr727549vsv.4.1712080594706; Tue, 02 Apr 2024 10:56:34 -0700 (PDT) Received: from x1gen2nano ([2600:1700:1ff0:d0e0::33]) by smtp.gmail.com with ESMTPSA id gw4-20020a0562140f0400b00698fd28cad3sm3465470qvb.80.2024.04.02.10.56.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 10:56:34 -0700 (PDT) Date: Tue, 2 Apr 2024 12:56:32 -0500 From: Andrew Halaney To: Dmitry Baryshkov Cc: Bjorn Andersson , Konrad Dybcio , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] soc: qcom: pmic_glink: don't traverse clients list without a lock Message-ID: References: <20240402-pmic-glink-fix-clients-v1-0-885440b81c65@linaro.org> <20240402-pmic-glink-fix-clients-v1-1-885440b81c65@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240402-pmic-glink-fix-clients-v1-1-885440b81c65@linaro.org> 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? > > 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 > >