Re: [PATCH v2] media: camss: Intepret OF graph connections more sensibly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 17, 2023 at 02:40:05PM +0200, Konrad Dybcio wrote:
> On 17.07.2023 12:48, Johan Hovold wrote:
> > On Sat, Jul 15, 2023 at 05:37:52PM +0200, Konrad Dybcio wrote:

> >> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> >> index 1ef26aea3eae..8b75197fa5d7 100644
> >> --- a/drivers/media/platform/qcom/camss/camss.c
> >> +++ b/drivers/media/platform/qcom/camss/camss.c
> >> @@ -1084,9 +1084,8 @@ static int camss_of_parse_ports(struct camss *camss)
> >>  
> >>  		remote = of_graph_get_remote_port_parent(node);
> >>  		if (!remote) {
> >> -			dev_err(dev, "Cannot get remote parent\n");
> >> -			ret = -EINVAL;
> >> -			goto err_cleanup;
> >> +			of_node_put(node);
> > 
> > This is broken and could potentially lead to a use after free.
> > 
> > Specifically, the iteration macro already takes care of putting this
> > reference.

> /**
>  * for_each_endpoint_of_node - iterate over every endpoint in a device node
>  * @parent: parent device node containing ports and endpoints
>  * @child: loop variable pointing to the current endpoint node
>  *
>  * When breaking out of the loop, of_node_put(child) has to be called manually.
>  */

Please read this comment you just pasted here again as it seems you did
not understand it.

> > 
> >> +			continue;

And again, please remember to trim your replies. Including context after
your reply is almost always wrong.

Johan



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux