Re: [PATCH 4.19.y-cip 11/17] drm: of: Add drm_of_lvds_get_dual_link_pixel_order

Biju Das <biju.das.jz@...>

Hi Pavel,

Thanks for the feedback.

Subject: Re: [PATCH 4.19.y-cip 11/17] drm: of: Add


commit 6529007522ded00b8912c079250620fa7a732166 upstream.

An LVDS dual-link connection is made of two links, with even pixels
transitting on one link, and odd pixels on the other link. The device
tree can be used to fully describe dual-link LVDS connections between
encoders and bridges/panels.
The sink of an LVDS dual-link connection is made of two ports, the
corresponding OF graph port nodes can be marked with either
dual-lvds-even-pixels or dual-lvds-odd-pixels, and that fully
describes an LVDS dual-link connection, including pixel order.
There is double-free bug here, AFAICT:

+for_each_child_of_node(port_node, endpoint) {
+struct device_node *remote_port;
+int current_pt;
+if (!of_node_name_eq(endpoint, "endpoint"))
+remote_port = of_graph_get_remote_port(endpoint);
+if (!remote_port) {
+return -EPIPE;
+current_pt =
You have put remote_port here.

+if (pixels_type < 0)
+pixels_type = current_pt;
+ * Sanity check, ensure that all remote endpoints have the
+ * pixel type. We may lift this restriction later if we need to
+ * support multiple sinks with different dual-link
+ * configurations by passing the endpoints explicitly to
+ * drm_of_lvds_get_dual_link_pixel_order().
+ */
+if (!current_pt || pixels_type != current_pt) {
+return -EINVAL;
And again here.

Now... it is only a problem in error path, so maybe easiest way is to fix it in
the mainline and then backport the fix here...
Yes I agree with you, there is double-free bug in error path. As you suggested, We should send a patch in mainline to fix this and backport here.


Renesas Electronics Europe GmbH, Geschaeftsfuehrer/President: Carsten Jauch, Sitz der Gesellschaft/Registered office: Duesseldorf, Arcadiastrasse 10, 40472 Duesseldorf, Germany, Handelsregister/Commercial Register: Duesseldorf, HRB 3708 USt-IDNr./Tax identification no.: DE 119353406 WEEE-Reg.-Nr./WEEE reg. no.: DE 14978647

Join to automatically receive all group messages.