Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1833999yba; Sun, 14 Apr 2019 22:23:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAcjKAjLf2XMDngopSINqYqVys3tuQQISk6Xe16PsnvrYHuYQDv69g3Y5eZdWcb01/zKuw X-Received: by 2002:a17:902:54c:: with SMTP id 70mr41518128plf.210.1555305794923; Sun, 14 Apr 2019 22:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555305794; cv=none; d=google.com; s=arc-20160816; b=r5Rq1XHhNCLJGZcI4nthhTUFP+TBs/Tnp499kASm/i+qatpe3i0qNTyn+vOkYDTku9 2NS1b7sZAWOfkZGMkkWbW/snUjXfBGkHtShk0vjc83hUWllkatihGF4OqF6byg6qvWAx oAMwCnSX/bK8c2R5cZ4WuPCkoa5GkeK5jDAiRCzrr3+qOxoY5ZCalj1ccj3tNjFpsF4m F60ZAfXwb94WGmC7tELSVcAhUCqsLSMPcMy/vXbkRHk0B0YJH9a9wuEu9bTZX1iw1dwC xdi7fHLGck+lro0YSkVcAB5dvtuua/uw5ZsmUrP27+yLep0svkYJrX+VV8T0bSfk3F4J 2PmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=4wAcsf0wOxTH+Mt/WXogNO8tVzfvRlR57HDInWFiJx8=; b=IA9WKtgXiVfSf9lS2LdW+W+mfFkw9VrC0z0DEH1lYThj+eWOC8ikiLrIuTpHH8o/Kp LcJ8Vi8z0IQmeDenDszWxwzAjuxr5fDAa1wRoHbgXeedu0RIb4g/OKr/J1ecOE6S2p9M bmEB5YZoTSS14S/g783UpPxLK+nAoz7hPYNvayY7qm66WNr5V12I4eGKo2OrEwid3GkV lSgMsNi+g+q2QnxJSuBfL8J1JMIo4bR+51OJ8JXXvGLRqzbfys/6AY25DJwLfkvSO2E0 xSmD7ItSwz6sXuLb2Ij53dEQX/iY9H/Rl/6mnYq7PJ/SWYZSNNQWWM7WHhpv5wCgMvY7 xBtQ== ARC-Authentication-Results: i=1; mx.google.com; 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 35si44326691pgz.383.2019.04.14.22.22.58; Sun, 14 Apr 2019 22:23:14 -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; 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 S1725853AbfDOFWY (ORCPT + 99 others); Mon, 15 Apr 2019 01:22:24 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:41845 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725777AbfDOFWY (ORCPT ); Mon, 15 Apr 2019 01:22:24 -0400 Received: by mail-lf1-f65.google.com with SMTP id t30so11993955lfd.8; Sun, 14 Apr 2019 22:22:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=4wAcsf0wOxTH+Mt/WXogNO8tVzfvRlR57HDInWFiJx8=; b=G27v/5BqVLYlrGJBgqU/dXHMitDlrMpQ32fRYUWbHJWY1grUajgKXwHB/z8xAd4xVZ lSBGwGK4fiWxamuQV7rh/5P5k5XLxI3Hab+YbjgZrDdMY3gA79JFV/PHrGABKcjEW1Vr cjsuH8q4ZR539sXi7TS9jxfyHsF6roSGKiK2hzWFeItTBmum0T9yC0Al0f1yKPE3qfOm sm6LlPCEvrMMLP5x4mjgXTJtSY6n8MVzvu+j7dCDtDYEZVDq9P/2m3rJuAt1YmGkJBZ9 ToNyg7s33mLqyjn6EtT/CxpZtWNEddzAJzob+3IXxF7OgZnSqeaZDULT8g+3HU+xDT7Y laZg== X-Gm-Message-State: APjAAAUWzqftsNDW7C9dJ8NONZUmu6X7IureaGQFqjswsoC3siAGDCpr O7VGznoS+Avc3Q6ARA9HohI= X-Received: by 2002:a19:3845:: with SMTP id d5mr4456759lfj.77.1555305742304; Sun, 14 Apr 2019 22:22:22 -0700 (PDT) Received: from localhost.localdomain (dyttpvnw7fb6wy5z8v7dt-4.rev.dnainternet.fi. [2001:14bb:420:c8ae:5b20:7520:669c:8ec7]) by smtp.gmail.com with ESMTPSA id c17sm2630765lfm.42.2019.04.14.22.22.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 22:22:21 -0700 (PDT) Date: Mon, 15 Apr 2019 08:22:14 +0300 From: Matti Vaittinen To: Stephen Boyd Cc: Michael Turquette , linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Miquel Raynal , Jerome Brunet , Russell King , Jeffrey Hugo , Chen-Yu Tsai Subject: Re: [PATCH v4 1/9] clkdev: Hold clocks_mutex while iterating clocks list Message-ID: <20190415052214.GA31948@localhost.localdomain> References: <20190412183150.102131-1-sboyd@kernel.org> <20190412183150.102131-2-sboyd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190412183150.102131-2-sboyd@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 12, 2019 at 11:31:42AM -0700, Stephen Boyd wrote: > We recently introduced a change to support devm clk lookups. That change > introduced a code-path that used clk_find() without holding the > 'clocks_mutex'. Unfortunately, clk_find() iterates over the 'clocks' > list and so we need to prevent the list from being modified at the same > time. Do this by holding the mutex and checking to make sure it's held > while iterating the list. > > Note, we don't really care if the lookup is freed after we find it with > clk_find() because we're just doing a pointer comparison, but if we did > care we would need to keep holding the mutex while we dereference the > clk_lookup pointer. > > Fixes: 3eee6c7d119c ("clkdev: add managed clkdev lookup registration") > Cc: Miquel Raynal > Cc: Jerome Brunet > Cc: Russell King > Cc: Michael Turquette > Cc: Jeffrey Hugo > Cc: Chen-Yu Tsai > Cc: Matti Vaittinen > Signed-off-by: Stephen Boyd Acked-By: Matti Vaittinen