Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.231.193 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796352184; b=z2lKRaTgeOSBSAY/8YGuhgkLukLUEgZJs5+osA3LWVbi1fRAuZ+lbHrAIsa85xbycxYw xSIHEpYMYavyL0l7T+pZtHaeZNDG8RBKnQesc60pza5jzd7OI/BhqahNR31NGpNqKUabi YxeYPWmOkfcPjewxENxTO5EEQDSnM92jp47/Z9MpyjeIBgrhESxmNrQp/6yctkcj1lNtS 8N64dHAQS8wChejQstyHKwCfs22/ao9DN82ImDu7dEdX621NK8D6tuU0PsZAnYB7ileLT rFli+PFeaWb3GXUc61n5OjBR+tGXHdZmpoNvyU2QRuNXne0PMcBXHbmPJcQwNagYDsA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796352184; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:Content-Language: From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=5H3MuGpHVzKcncH449jemRrt2ei+hruV+g0qEnN9Ttk=; b=qPH+yCO678ipc7laz8BeuAW9/WxPE5NHCpAN0SOjnH/VBaVF3hy1nR3T2qdCt7j72O9e 0dSPoIxg7Y+y7YHoerFq/J0kKYlZeQNcp+e0xE4E7lh7xyrywr5E+fd8UeFEY4lTMXLq0 qbLvDuY7RR6ba/XwGx/fxmztoVsKrs9/tsaBPTmd0TFMBuWry5XU9/JzT8OrpExqHMcH8 6vzUgofJaH2od0id0yN8vl+rtckuCBTFzLNBdlRJcXDRgZFMIDMbGX/1ediyb2LzErvju EVIVdXEdhg6suEBdykhnJjPSVDOX3Cjkr+EARHgvaDJePrG5GK41U5q5l+m300/cUtQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass header.d=riscstar.com header.i=@riscstar.com header.a=rsa-sha256 header.s=google header.b=RZV1WlHA; arc=none smtp.remote-ip=74.125.231.193 Received: from mail-oi2-f1.google.com (mail-oi2-f1.google.com [74.125.231.193]) (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 1136A606A335 for ; Fri, 4 Dec 2026 02:43:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1136A606A335 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar.com header.i=@riscstar.com header.a=rsa-sha256 header.s=google header.b=RZV1WlHA Received: by mail-oi2-f1.google.com with SMTP id 5614622812f47-539d2baa897so78689b6e.0 for ; Thu, 03 Dec 2026 18:43:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar.com; s=google; t=1796352183; x=1796956983; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=5H3MuGpHVzKcncH449jemRrt2ei+hruV+g0qEnN9Ttk=; b=RZV1WlHA4Fu2enqLQyEm32pynIKkdpG99ZKcGPOrY6pRIwOBrmUxtoarOWrkUX5cM6 szIVIC/nGvktziNIVlV9qGNRf6k8EKR2rg1zZN0k+nsk3nb320PK4EeGbrUr7E26WxCj UvjVpMsk27ZJWlJcrEywVGn5OdSDQlSUvSeP5EaQmeyjqwPh4YqumI96kTcQGrm2Nq9M H3XUiDG+Ibpk5vt7tXfey55uLuRY+42wOOmEE2csCU+UmCgtDT+xrQ8zvGxP8wXWkKBQ UtO/P8Qv8BYn89zLFzGE9cc8SHC+e7T9Ecr5xCxqK3obxcxOt+gdKZMHNUGGUkq+Csbu XLwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796352183; x=1796956983; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=5H3MuGpHVzKcncH449jemRrt2ei+hruV+g0qEnN9Ttk=; b=V/vmzmw4xnDSbXKgKKybNByQwUS/E78QhQKnVn9uxU32q1VmdMkJnG0EZpgSpepHkF 2hTs6sbbVQYlhnv+measW65tRVhaBryBc+FI5IeQATswkrRKNcFe6imiTxYYv5aLKAtV pDnTCta0RmmRFOpdQvH/eZ8ssoHI/XOdQoXPQuhXL6bU/YVKtHBcC8foZKMAbO3rEMOI ybq6I3gMP841676EjS+yZE9BOP2hAvXu8IuINvsc89RiLDovULMWQEcpyoVhlzQ9XCqy e216d9AZxDaYWiChFcLMoRMjd3YvCokY2+7BcseOANcnCEBgJdSVdolx+0g9yKSLbzpb QFHA== X-Gm-Message-State: APuU4Z/dI9GT44u9G27ReK5zilFcXHlyD013GThzLJxPk6pa9Rs6jJuI g0NVhSuJkyKSiO1I0QDkmS4YLuHpKczqJmHW20Qkx3JaOZFgvlhlm8hvJc0pESyZ7s8= X-Gm-Gg: AZFdTZdtg7OXfOl95c6vAoT3VDApLtoBg/o5YzdhhgXTExlm65xPfTgMfBV6LCdDuWY x1BzEDtlIeiwXfwyJ4ImNs1KgSb2Y6hdK8x1+i5Q5BHjjP8Ye6dkq9+g04QacCVD3RSE5tgBfCT ABSM/QWnI1zdm3T/oF8B9dZF4719WzWZGMgJYkkVWrt3eXSU09Rmkz5cbwV99xZ5mFP3Efn7J71 C/hG/Joss5OI75ws/YpiglodT2QO09Qqhgr5XLuH4iSKtseQYGZ4tX89sMWaDdf2fGWdU8aAjKA 8YBzaMgphZlWwH6LdmRTr+YzJJBGftI0BOtWbtCrjbg+0kddp5DKbZXoWy7OpCMX0KqCb8ghF80 g84uQT5SDBfbqDt3Ox7HSR4jUyBg447Qtiaqoo2g7EAmII4yQAlW5+8Z9WEcs9mxH6h4amK4tVb qpD8Dvne/jtT14M1lwPkvJPv97rW+BQ1X4RkmrHTSmn4BmqJJFdWYs1Epmkq4fhoF5tGaeBj5QS D+TnFubnjZ+SnBoTDOsx2VWtW+vYz3vJlFKhGwCT91hJQvmFmdRTGYoc8jM5kRgcTG9QYLv0dZ2 2S3+4X1xbbvExBC03qhWeAekZ+gSoVU= X-Received: by 2002:a05:6808:1811:b0:567:c9d6:b2b2 with SMTP id 5614622812f47-57f20806496mr638454b6e.47.1796352182945; Thu, 03 Dec 2026 18:43:02 -0800 (PST) Received: from [172.22.22.28] ([76.156.233.211]) by smtp.gmail.com with ESMTPSA id 5614622812f47-57f1f6a74e8sm572711b6e.7.2026.12.03.18.43.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Dec 2026 18:43:02 -0800 (PST) Message-ID: <94d0865f-df47-463a-9f41-9acc07d4e9a6@riscstar.com> Date: Thu, 3 Dec 2026 20:43:02 -0600 X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 4/4] arm64: dts: qcom: qcs6490-rb3gen2: add TC9564 clock node To: sashiko-reviews@lists.linux.dev Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org References: <20261203200948.1595470-1-elder@riscstar.com> <20261203200948.1595470-5-elder@riscstar.com> Content-Language: en-US From: Alex Elder In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/3/26 2:28 PM, sashiko-bot@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 3 potential > issues to consider: > - [High] arm64: dts: qcom: BAR4 translation fails for TC9564 > clock-controller@1004 > - [Medium] clk: toshiba: devm_reset_register() frees aux_data before > auxdev destroy > - [Medium] clk: toshiba: devm_reset_register() leaks aux_data on > ida_alloc() failure > -- > > commit 179c9f9b50bcdb23af6216cf3aeac69795b3017e > Author: Alex Elder > > arm64: dts: qcom: qcs6490-rb3gen2: add TC9564 clock node > > This commit adds a fixed 25 MHz crystal clock node and a TC9564 clock and > reset controller node under pci-ep-bus@4 in the QCS6490 RB3Gen2 device tree. > >> diff --git a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts >> index 682bcbc0b466b..87035745b6720 100644 >> --- a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts >> +++ b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts > > [ ... ] > >> @@ -969,6 +976,14 @@ pci-ep-bus@4 { >> #size-cells = <1>; >> /* Map 0x0-0x1fffff to BAR 4 */ >> ranges = <0x0 0x4 0x0 0x0 0x200000>; >> + >> + clock-controller@1004 { >> + compatible = "toshiba,tc9564-clock"; >> + reg = <0x1004 0x10>; >> + clocks = <&tc9564_xo_board>; >> + #clock-cells = <1>; >> + #reset-cells = <1>; >> + }; > > [Severity: High] > Can address translation for clock-controller@1004 succeed with dev@0,0's > static placeholder ranges? > > During PCI enumeration, pci_setup_device() -> pci_set_of_node() binds the > static dev@0,0 node to the PCI device. Because pci_device_to_OF_node() is > then already non-NULL, the final fixup of_pci_make_dev_node() returns early > without updating dev@0,0's ranges property. This is correct. This is a problem that must be solved by another series I have had out for review for several months. https://lore.kernel.org/lkml/20261105212412.591931-3-elder@riscstar.com/ The series causes a PCI function's ranges property to be updated dynamically, even if the devicetree node for the PCI device is non-null at the start of of_pci_make_dev_node(). > When tc9564_function_probe() populates the bus, of_address_to_resource() > translates reg = <0x1004 0x10> via the stale BAR 4 range to 0x85004, outside > pcie1's 0x40300000 MEM window in kodiak.dtsi. of_device_alloc() then hits > WARN_ON(rc) and tc9564_clk_probe() fails with -EINVAL. I no longer recall precisely what happens but this sounds about right. Without the series mentioned above, address mapping done by of_address_to_resource() fails. I think this report from Sashiko is correct (and fairly involved), but there is a proposed fix. > [Severity: Medium] > In the bound clock driver from commit "clk: toshiba: introduce a TC9564 > clock driver", does devm_reset_register() in drivers/clk/clk-tc9564.c free > aux_data and the IDA ID while the auxiliary device is still registered? What follows are repeated reports that were already mentioned for patch 3 in this series. -Alex > > __devm_auxiliary_device_create() registers auxiliary_device_destroy() as a > devres action before returning. Registering reset_adev_free() afterwards > means LIFO teardown frees aux_data and calls ida_free() before > auxiliary_device_destroy() removes the device: > > CPU0 CPU1 > devres_release_all() > reset_adev_free() > ida_free(&reset_ids, adev->id) > kfree(aux_data) > tc9564_reset_probe() > aux_data = dev_get_platdata(dev) > aux_data->regs <-- use-after-free > auxiliary_device_destroy() > > Registering cleanup for aux_data and the IDA ID before creating the > auxiliary device avoids both the use-after-free and early ID reuse. > > [Severity: Medium] > Also in drivers/clk/clk-tc9564.c:devm_reset_register(), does the ida_alloc() > error path leak aux_data? aux_data is allocated with kzalloc_obj() right > before ida_alloc(), but an allocation failure returns dev_err_probe() > without calling kfree(aux_data). >