<div dir="ltr"><div>2017-01-28 15:01 GMT-02:00 Marek Vasut <<a href="mailto:marex@denx.de">marex@denx.de</a>>:<br>><br>> The mxsfb driver will crash if the mxsfb DT node has a subnode,<br>> but the content of the subnode is not of-graph binding with an<br>> endpoint linking to panel. The crash was triggered by providing<br>> old-style panel bindings to the mxsfb driver instead of the new<br>> of-graph ones.<br>><br>> The problem happens in mxsfb_create_output(), which is invoked<br>> from mxsfb_load(). The mxsfb_create_output() iterates over all<br>> mxsfb DT subnode endpoints and tries to bind a panel on each<br>> endpoint. If there is any problem binding the panel, that is,<br>> mxsfb->panel == NULL, this function will return an error code,<br>> otherwise success 0 is returned.<br>><br>> If the subnodes do not specify of-graph binding with an endpoint,<br>> the iteration over endpoints in mxsfb_create_output() will have<br>> zero cycles and the function will immediatelly return 0, but the<br>> mxsfb->panel will remain NULL. This is propagated back into the<br>> mxsfb_load(), which does not detect any problem and expects that<br>> the mxsfb->panel is valid, thus calls mxsfb_panel_attach(). But<br>> since mxsfb->panel == NULL, mxsfb_panel_attach() is called with<br>> first argument NULL and this crashes the kernel.<br>><br>> This patch fixes the problem by explicitly checking for valid<br>> mxsfb->panel at the end of the iteration in mxsfb_create_output().<br>><br>> Signed-off-by: Marek Vasut <<a href="mailto:marex@denx.de">marex@denx.de</a>><br>> Cc: Daniel Vetter <<a href="mailto:daniel.vetter@ffwll.ch">daniel.vetter@ffwll.ch</a>><br>> Cc: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>> Cc: Stefan Agner <<a href="mailto:stefan@agner.ch">stefan@agner.ch</a>><br>> Cc: Breno Matheus Lima <<a href="mailto:brenomatheus@gmail.com">brenomatheus@gmail.com</a>><br><br></div>Tested-by: Breno Lima <<a href="mailto:breno.lima@nxp.com">breno.lima@nxp.com</a>><br></div>