From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.54 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796311261; b=FGPylNxO82frpSauOZkBHnHErYjhuLm1TLn6YMM1UlAo9sjKuB7DEGv1EbcHx1nW8Cjm IW14WxzxNDgtutFPO+rYikRc7JNluDo5fvRst1MFGNibMYOyJcZd3FQRZslTedWHb4izg RSVfsBhnh6cm4tBeQFQBkVymhSV6xeqPOVxFr+dc+1h7FDKhf40NFGqOL2KFFse6JqKHZ 8tu7bQSR0p6BvxQg1Os2laqTCKBdqCtQMKaUNtj6mT4utcjD64jIFjt/HTAgVAUswe0HP HRYI884dOL8NqixiiC0CdVAfQCo7I+G6ATsaDdmL6c7Xm9BJ00I3w0H0PPP+m/JIn8g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796311261; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=STArO6ogGzbMPlZ1pMAQt65zzpcmFlyFDlvYjrilMAk=; b=lcSkDjGCLMNKh1WtHPgtpFHohwHx8EOmB77sLHR8pOoO9f37g4VB+1q9EeNwLJAvNfX7 Z7Nyv/fSpzxog6a1Mxy/vLgFhj9dylBsd+xlnuc04zxsAFiGZ+NIbQPgtSQWiamLQQEBC eOGNCGgVT1v8DI1rYwvVoMMJjnP9WLL4rOnVdXYFmMwuUgsz9uwknXn1LXT1wIOvLmbDb Mrbm/jqhWnwox5iDygE0W/fUApq400ByA/hTRTziG2mAPkqYs/0SZcba0mi8xLg2+AdKG aG/GT3t9U3D10e0hvHySrPXBvjGqkGihQAJQhTR0DqUm4CwXmcqhoS5pcUfV3R2xm3Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=DVI09QzT; arc=none smtp.remote-ip=209.85.128.54 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 296AB60A5BFC for ; Thu, 3 Dec 2026 15:21:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 296AB60A5BFC Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=DVI09QzT Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4a2000d5fb1so86358225e9.1 for ; Thu, 03 Dec 2026 07:21:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796311259; x=1796916059; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=STArO6ogGzbMPlZ1pMAQt65zzpcmFlyFDlvYjrilMAk=; b=DVI09QzTc6SDCIKZNOsmdAxzNW5vPvBxm+S57NJY0bIsDxuGoV1K0nWSGEKrqWVHcF /Slj9POR60gYcJvCkgvW9ndudXJQnFJ4i3XxoLHCF4oR/3ZCvJabK7MfMfQvKBpVAaEA sXnwFWMuOgryfyAUpbu0hOVIZ5Vr4xVGs6+oetv0ITLax3cp1EuUd2uP+vNYqBk1taOh L43kcLB/1rI2dBdd9JAHiP2sfTMLpX9Rov7Jj2u4kz9Xt5kd0Pr2b9GM2I98gXd+oZLs NSnxk8SdvOLW1mgc93z+dIEubu1qmrFVLIEBZHxtOsT5hRfIubVrVxBbzj4EqXQIAKmJ FfKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796311259; x=1796916059; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=STArO6ogGzbMPlZ1pMAQt65zzpcmFlyFDlvYjrilMAk=; b=ZB8zhO9B065l6zSQ/aQ/gJOUS0PYNZ7tGZZb3J3Dbpx2poDXU2meEPeW04od+GGeiD eZftJ0mrw9fBZ8MJYGY0Gsj0Si1oZ2oYMWuVsJoZ1uLn7UWneIhtwMcoGLVyalPoSduO BytXDQ/4UbLZZgT8TG1Oqx4rDmo+8yycrrI+7uud1JFsTe7ooiXxcR778h0eWhENsJRL 0BwV2qR1UCXRyikhIb6ePyhz/1sY5Po4x1Fx8qRfvo/Dhj0pOLPg+YuGKQXrAICFRXhR PHzcmW4Nvt4XzKK2K9h0AgBUti+htB4of+LzQ834BObwJwYbZiyV9BprUFhQXU7CJf39 tZ1w== X-Forwarded-Encrypted: i=1; AL+hErG8Ardcr8UUyNxEi6aFrm5zq0KeQQ5ghAL3bZUMNzTDSBP+kXQlJYIaX3Q3kDXOi5UlVg9MhXDo2ZPFXyg=@vger.kernel.org X-Gm-Message-State: APuU4Z//1+ClPpDmVo0xSvDxRkcx3eY4brxboQas49Iide/iYZEths7e pw5QpUYru86rgNMeszZT+JTvurKDkhTtxVqD+OV6BlxwlRq6dguLyXb4 X-Gm-Gg: AZFdTZeZCa4uH0oCt6xywJmUfKYfjKtCcwpQ2guxND3hmNoyAz/fOIQqKUPs+VXLRLn Uk8fExoFHkawyAGW7ObH4/26kHDvREgv2CeqZ98R6j8W/E2yoh95e2S+wNb/t8KyBPQ6nklXKL9 UG/hTwG1LOxlBZE2WyW1MA/y8k6OKaGQfS1xswVuiDWxI+m1yxv1SsQJVCSXLXCpU7UpbKb/IAk +Z8HWFGYgxe3FLeqBy+bPUuhlUVa1aoJ3JcRCih6brZhHJ0vmFPXOsZa/HTHtZdO/THzyGmMVfz /UBUtFkU6jtOWzwcCJ+3quBY/kbRkUMWeMAqkPJ/5fJx9UNcWfija9pWX1WRv7JDv69yr7dvozr 6zv6UbYl5ZhJ5PjfEfTwomuXLM8X2HF6sqqWEOUeRx6jfUnaQQG3JX6Nxwkp0bbf32vIHdSpkRY OD3AV1apYGej3zg8RAmUODja1RAhMZ4opFlrafdlau4AK0o+sHY+AffjSzyltwOTAVISift1PXO CZs94PmLlgX7wu7HkrLe4DYr9TP1AOfn9W8cVya8xjhGWjDWnI+ji2YEEvWa94O11lFkzPC8CVJ MwLpzc8HYb7vIyzD23KGOnATY4CPbuhXuzSP5FzmiIb0+6FVZyJwuLECG2eIRnY7KeQTv13a X-Received: by 2002:a05:600c:530f:b0:4bb:680f:9a3 with SMTP id 5b1f17b1804b1-4bb887e220emr870058555e9.2.1796311259413; Thu, 03 Dec 2026 07:20:59 -0800 (PST) Received: from localhost-live.home.vlan10 (053da82f.dynamic.tele-ag.de. [5.61.168.47]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbe00daf7fsm87839515e9.13.2026.12.03.07.20.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 07:20:58 -0800 (PST) From: Joshua Covington To: Jerome Brunet Cc: Joshua Covington , Stephen Boyd , Brian Masney , Brian Masney , Jerome Brunet , Andrea della Porta , Florian Fainelli , Sylwester Nawrocki , linux-clk@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v3 1/3] clk: allow a clk_hw to be registered again after unregistering it Date: Thu, 3 Dec 2026 15:19:54 +0000 Message-ID: <20261203151954.139565-1-joshuacov@gmail.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <179629359981.3767986.8254684000680163977.b4-review@b4> References: <20261124231751.83938-1-joshuacov@gmail.com> <20261124231751.83938-2-joshuacov@gmail.com> <179629359981.3767986.8254684000680163977.b4-review@b4> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Jerome, Thanks for the review. On Thu, Dec 03, 2026 at 11:26:39AM +0100, Jerome Brunet wrote: > IMO, the short term solution to the problem explained in this series is to > stop poisoning the init data in clk_hw. The framework did not allocate the > data, arguably it should not be wrecking it on purpose or otherwise touch it. > Just leave it be. > > We should however put clear comment/warning that provider driver should NOT > be using that or count on it being valid. That works for me, and it will remove the new clk_core member and the object_is_on_stack() check. So far I have tried it on top of v3, with __clk_register() no longer clearing hw->init. The tests for registering again after unregistration and after a failed registration pass. In v4 I will also add to the clk_hw kernel-doc that providers must not use @init after registration, as it may point to init data that is gone. The other half of the patch still needs to stay, though. clk_unregister() leaves hw->core and hw->clk pointing to the clk_core and clk it releases. Without clearing them, a clk_parent_data.hw reference to an unregistered clk_hw resolves to the freed clk_core, and KASAN reports a slab-use-after-free in __clk_register() in the parent test. That part costs no memory, so I would keep it. Stephen, the hw->init poisoning was added by 0214f33c4e0e. Are you fine with dropping it? If so, I will send a v4 that does the above, with the test for init data on the stack removed. > The longer term solution would be stop it storing altogther. I think that > would mean adding a new registration API that takes the init data as parameter > and provide the clk_hw in return ... them slowly convert everything, then drop it. Agreed. That is beyond the scope of this fix, and the decision on it is for you and Stephen. Thanks, Joshua