Re: [PATCH] drm/mipi-dsi: fix UAF on device_add() failure

Linkai Gong <[email protected]>
Newsgroups org.freedesktop.lists.dri-devel,dev.linux.lists.sashiko-reviews
Message-ID <[email protected]>
On Thu, Aug 06, 2026 at 08:09:45 +0000, [email protected] wrote:
> [High] The patch introduces inconsistent ownership semantics for the
> info->node reference on error paths...

Thanks for the review.

The put_device() change is still required: mipi_dsi_device_alloc()
calls device_initialize(), so the error path must release the device
through put_device() rather than kfree().

Regarding of_node: device_set_node(of_fwnode_handle(info->node)) does
not take a reference, while mipi_dsi_dev_release() calls of_node_put().
That imbalance already exists on the success path when the device is
later unregistered; this patch only makes the same release helper run
on the device_add() failure path as well.

I can follow up with a separate change for the of_node refcounting if
the maintainers want that cleaned up. Happy to adjust based on human
reviewer feedback.

Thanks,
Linkai
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.