<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/drivers/spmi, branch linux-6.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.9.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-6.9.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2024-06-21T12:40:33Z</updated>
<entry>
<title>spmi: hisi-spmi-controller: Do not override device identifier</title>
<updated>2024-06-21T12:40:33Z</updated>
<author>
<name>Vamshi Gajjela</name>
<email>vamshigajjela@google.com</email>
</author>
<published>2024-05-07T21:07:41Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=378167f11bbc6b9879e8e50b7c987c21e8736c06'/>
<id>urn:sha1:378167f11bbc6b9879e8e50b7c987c21e8736c06</id>
<content type='text'>
commit eda4923d78d634482227c0b189d9b7ca18824146 upstream.

'nr' member of struct spmi_controller, which serves as an identifier
for the controller/bus. This value is a dynamic ID assigned in
spmi_controller_alloc, and overriding it from the driver results in an
ida_free error "ida_free called for id=xx which is not allocated".

Signed-off-by: Vamshi Gajjela &lt;vamshigajjela@google.com&gt;
Fixes: 70f59c90c819 ("staging: spmi: add Hikey 970 SPMI controller driver")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240228185116.1269-1-vamshigajjela@google.com
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20240507210809.3479953-5-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: pmic-arb: Replace three IS_ERR() calls by null pointer checks in spmi_pmic_arb_probe()</title>
<updated>2024-06-12T09:39:18Z</updated>
<author>
<name>Markus Elfring</name>
<email>elfring@users.sourceforge.net</email>
</author>
<published>2024-05-07T21:07:42Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=217b057cdbeefb049fd00e39c088da573e0437a7'/>
<id>urn:sha1:217b057cdbeefb049fd00e39c088da573e0437a7</id>
<content type='text'>
[ Upstream commit c86f90e30a347ef0a28d0df3975c46389d0cc7fc ]

The devm_ioremap() function does not return error pointers.
It returns NULL on error.
This issue was detected once more also by using the Coccinelle software.

Update three checks (and corresponding error codes) for failed
function calls accordingly.

Fixes: ffdfbafdc4f4 ("spmi: Use devm_spmi_controller_alloc()")
Fixes: 231601cd22bd ("spmi: pmic-arb: Add support for PMIC v7")
Signed-off-by: Markus Elfring &lt;elfring@users.sourceforge.net&gt;
Link: https://lore.kernel.org/r/82a0768e-95b0-4091-bdd1-14c3e893726b@web.de
Reviewed-by: Dmitry Baryshkov &lt;dmitry.baryshkov@linaro.org&gt;
Reviewed-by: David Collins &lt;quic_collinsd@quicinc.com&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20240507210809.3479953-6-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>spmi: mediatek: add device id check</title>
<updated>2023-12-15T16:27:04Z</updated>
<author>
<name>Sen Chu</name>
<email>sen.chu@mediatek.com</email>
</author>
<published>2023-12-06T23:17:31Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c49739235c426b05539589de2ffde2bbf71ae468'/>
<id>urn:sha1:c49739235c426b05539589de2ffde2bbf71ae468</id>
<content type='text'>
Add device id check for spmi write API.

Signed-off-by: Sen Chu &lt;sen.chu@mediatek.com&gt;
Link: https://lore.kernel.org/r/20230518040729.8789-1-sen.chu@mediatek.com
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20231206231733.4031901-9-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: Return meaningful errors in spmi_controller_alloc()</title>
<updated>2023-12-15T16:27:04Z</updated>
<author>
<name>Fei Shao</name>
<email>fshao@chromium.org</email>
</author>
<published>2023-12-06T23:17:30Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=3ae3cf418a01203c33113e19cc1029ac434c96b5'/>
<id>urn:sha1:3ae3cf418a01203c33113e19cc1029ac434c96b5</id>
<content type='text'>
spmi_controller_alloc() currently returns NULL to all types of errors,
which can be improved.

Use appropriate error code in returns and pass the errors from used
functions where possible.

Signed-off-by: Fei Shao &lt;fshao@chromium.org&gt;
Link: https://lore.kernel.org/r/20230824104101.4083400-6-fshao@chromium.org
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20231206231733.4031901-8-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: hisi-spmi-controller: Use devm_spmi_controller_add()</title>
<updated>2023-12-15T16:27:04Z</updated>
<author>
<name>Fei Shao</name>
<email>fshao@chromium.org</email>
</author>
<published>2023-12-06T23:17:29Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=490d88ef548d463c85bd75ef5300b25c92d71e5a'/>
<id>urn:sha1:490d88ef548d463c85bd75ef5300b25c92d71e5a</id>
<content type='text'>
Convert to the device-managed version of spmi_controller_add() and
delete the unnecessary driver remove callback.

Signed-off-by: Fei Shao &lt;fshao@chromium.org&gt;
Link: https://lore.kernel.org/r/20230824104101.4083400-5-fshao@chromium.org
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20231206231733.4031901-7-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: mtk-pmif: Reorder driver remove sequence</title>
<updated>2023-12-15T16:27:04Z</updated>
<author>
<name>Fei Shao</name>
<email>fshao@chromium.org</email>
</author>
<published>2023-12-06T23:17:28Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=f3e67fc406909fca9429b4283f243e855fab5c59'/>
<id>urn:sha1:f3e67fc406909fca9429b4283f243e855fab5c59</id>
<content type='text'>
This driver enables clocks and then adds SPMI controller in probing, so
we expect the reversed sequence in removal.
Fix the order in the remove callback.

Signed-off-by: Fei Shao &lt;fshao@chromium.org&gt;
Link: https://lore.kernel.org/r/20230824104101.4083400-4-fshao@chromium.org
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20231206231733.4031901-6-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: Use devm_spmi_controller_alloc()</title>
<updated>2023-12-15T16:27:04Z</updated>
<author>
<name>Fei Shao</name>
<email>fshao@chromium.org</email>
</author>
<published>2023-12-06T23:17:27Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ffdfbafdc4f46a92e6bebaa61048b9f56301e2fa'/>
<id>urn:sha1:ffdfbafdc4f46a92e6bebaa61048b9f56301e2fa</id>
<content type='text'>
Convert to the device-managed version of spmi_controller_alloc() and
simplify the excess error handling code.

Signed-off-by: Fei Shao &lt;fshao@chromium.org&gt;
Link: https://lore.kernel.org/r/20230824104101.4083400-3-fshao@chromium.org
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20231206231733.4031901-5-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: Introduce device-managed functions</title>
<updated>2023-12-15T16:27:04Z</updated>
<author>
<name>Fei Shao</name>
<email>fshao@chromium.org</email>
</author>
<published>2023-12-06T23:17:26Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b6e53731e07db7e8d35b789fd83565fe75540180'/>
<id>urn:sha1:b6e53731e07db7e8d35b789fd83565fe75540180</id>
<content type='text'>
Utilize the managed resource (devres) framework and add the following
devm_* helpers for the SPMI driver:

- devm_spmi_controller_alloc()
- devm_spmi_controller_add()

[sboyd@kernel.org: Rename to spmi-devres for module niceness, slap on
GPL module license]

Signed-off-by: Fei Shao &lt;fshao@chromium.org&gt;
Link: https://lore.kernel.org/r/20230824104101.4083400-2-fshao@chromium.org
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20231206231733.4031901-4-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: mediatek: Fix UAF on device remove</title>
<updated>2023-12-15T16:27:04Z</updated>
<author>
<name>Yu-Che Cheng</name>
<email>giver@chromium.org</email>
</author>
<published>2023-12-06T23:17:25Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=e821d50ab5b956ed0effa49faaf29912fd4106d9'/>
<id>urn:sha1:e821d50ab5b956ed0effa49faaf29912fd4106d9</id>
<content type='text'>
The pmif driver data that contains the clocks is allocated along with
spmi_controller.
On device remove, spmi_controller will be freed first, and then devres
, including the clocks, will be cleanup.
This leads to UAF because putting the clocks will access the clocks in
the pmif driver data, which is already freed along with spmi_controller.

This can be reproduced by enabling DEBUG_TEST_DRIVER_REMOVE and
building the kernel with KASAN.

Fix the UAF issue by using unmanaged clk_bulk_get() and putting the
clocks before freeing spmi_controller.

Reported-by: Fei Shao &lt;fshao@chromium.org&gt;
Signed-off-by: Yu-Che Cheng &lt;giver@chromium.org&gt;
Link: https://lore.kernel.org/r/20230717173934.1.If004a6e055a189c7f2d0724fa814422c26789839@changeid
Tested-by: Fei Shao &lt;fshao@chromium.org&gt;
Reviewed-by: Fei Shao &lt;fshao@chromium.org&gt;
Reviewed-by: Chen-Yu Tsai &lt;wenst@chromium.org&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20231206231733.4031901-3-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spmi: mtk-pmif: Serialize PMIF status check and command submission</title>
<updated>2023-12-15T16:27:04Z</updated>
<author>
<name>Nícolas F. R. A. Prado</name>
<email>nfraprado@collabora.com</email>
</author>
<published>2023-12-06T23:17:24Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=f200fff8d019f2754f91f5d715652e3e3fdf3604'/>
<id>urn:sha1:f200fff8d019f2754f91f5d715652e3e3fdf3604</id>
<content type='text'>
Before writing the read or write command to the SPMI arbiter through the
PMIF interface, the current status of the channel is checked to ensure
it is idle. However, since the status only changes from idle when the
command is written, it is possible for two concurrent calls to determine
that the channel is idle and simultaneously send their commands. At this
point the PMIF interface hangs, with the status register no longer being
updated, and thus causing all subsequent operations to time out.

This was observed on the mt8195-cherry-tomato-r2 machine, particularly
after commit 46600ab142f8 ("regulator: Set PROBE_PREFER_ASYNCHRONOUS for
drivers between 5.10 and 5.15") was applied, since then the two MT6315
devices present on the SPMI bus would probe assynchronously and
sometimes (during probe or at a later point) read the bus
simultaneously, breaking the PMIF interface and consequently slowing
down the whole system.

To fix the issue at its root cause, introduce locking around the channel
status check and the command write, so that both become an atomic
operation, preventing race conditions between two (or more) SPMI bus
read/write operations. A spinlock is used since this is a fast bus, as
indicated by the usage of the atomic variant of readl_poll, and
'.fast_io = true' being used in the mt6315 driver, so spinlocks are
already used for the regmap access.

Fixes: b45b3ccef8c0 ("spmi: mediatek: Add support for MT6873/8192")
Signed-off-by: Nícolas F. R. A. Prado &lt;nfraprado@collabora.com&gt;
Link: https://lore.kernel.org/r/20230724154739.493724-1-nfraprado@collabora.com
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Reviewed-by: Alexandre Mergnat &lt;amergnat@baylibre.com&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Link: https://lore.kernel.org/r/20231206231733.4031901-2-sboyd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
