Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1013625yba; Thu, 18 Apr 2019 13:36:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbs4I5UkBMGQ8VE4VrdszzyOe0Pj8JwQlaOYWlcTi6owlJniUqHft6jNWVtnD3n2SZJ+DW X-Received: by 2002:a63:c605:: with SMTP id w5mr85581283pgg.355.1555619796131; Thu, 18 Apr 2019 13:36:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555619796; cv=none; d=google.com; s=arc-20160816; b=eBHlJ7SHG5k8PL3FYp7bzobJ3btItEDBZdCmct+8KPXt5C72Qj4XnQqeIB7+TiHKn6 M4qcSPQST4u6G+v0d3Gk5YE/0xwpO9tTF9zczHuIPezHQdgdiyy1YxpdIMm+nxsFDnC1 uKPnvsCABGvCN0P2sb5PESxafZDKbG04F7gMUWixt+nv/yK9GYO7w3g7UNyLSHzSpLlt OopWF/hxuvf2Qq68cx/CfoYL1P1g9H2iSZXuKAtYWrZNVvbpiOgI0WltpOAlm3NcPk4l qmHS1WjkvW+0eGCZh0UEFN3qyg/WdbPEk1y6tgos+S3d1s3dJtK+oyhCRIST4FFNP3EM cBwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:user-agent:message-id:to:subject :from:cc:references:in-reply-to:content-transfer-encoding :mime-version:dkim-signature; bh=HiYMyuF2OM3FgJZMk6YRr/+ImxvjK6FMr6wB2n4Iu/c=; b=vEoCZEGt3xnDDW/opHojm1nmuj/Pr/7ogODy/WrFF11rsDhXl67SVtrOtjt5MZ5AMK MHffkLDLbEZf5FM03iPo0mA3gydNwi8r74fQM6dyw8Dp2JvMR/ii0HFNzq9lY+U6JD+Y T7USluY0HleJ1l2mHDvR5zKw1OiUJya0JNO0h9KWFPN6R2QeCHy+iSJ6By63rdPJjEEf D1X0RMeujdin3YfratYL626N/5cR/JWBofUjgXTXr6jLtwy3tG3zpW5gBNIH185fFLIh kHJIxkQxP9ppnEmPOO7GcHmfi3LrsQdubMZLCjESD4xD85Aup3QhqbWibHe4Gt5QKJ8E jbew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gvDJbleQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f11si3039220plo.169.2019.04.18.13.36.20; Thu, 18 Apr 2019 13:36:36 -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; dkim=pass header.i=@kernel.org header.s=default header.b=gvDJbleQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390147AbfDRUeS (ORCPT + 99 others); Thu, 18 Apr 2019 16:34:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:51390 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729198AbfDRUeS (ORCPT ); Thu, 18 Apr 2019 16:34:18 -0400 Received: from localhost (unknown [104.132.0.74]) (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 5CE31214C6; Thu, 18 Apr 2019 20:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555619657; bh=HiYMyuF2OM3FgJZMk6YRr/+ImxvjK6FMr6wB2n4Iu/c=; h=In-Reply-To:References:Cc:From:Subject:To:Date:From; b=gvDJbleQxIoLO/m0JRqSMLq3CtLv1BTfn2HkM76du0H2y3zD5ZtXFCJZ6fI6oRnbD fDAlZXgPfVMkwqnFHi31cKJM4cVSu2n1hQqnLo4wR3D7v/vcr+1tn2XlBn66Q9d9ip FlqCoQ77ypE+Me0uk2Hu8e35WJcyoSS29bipvgCs= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20190412183150.102131-2-sboyd@kernel.org> References: <20190412183150.102131-1-sboyd@kernel.org> <20190412183150.102131-2-sboyd@kernel.org> Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Miquel Raynal , Jerome Brunet , Russell King , Jeffrey Hugo , Chen-Yu Tsai , Matti Vaittinen From: Stephen Boyd Subject: Re: [PATCH v4 1/9] clkdev: Hold clocks_mutex while iterating clocks list To: Michael Turquette , Stephen Boyd Message-ID: <155561965658.15276.12512792107221989677@swboyd.mtv.corp.google.com> User-Agent: alot/0.8 Date: Thu, 18 Apr 2019 13:34:16 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Stephen Boyd (2019-04-12 11:31:42) > 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. >=20 > 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. >=20 > 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 > --- Applied to clk-fixes