Re: [PATCH v4 1/8] [media] soc_camera: Do not decrement endpoint node refcount in the loop

2014-09-29 Thread Greg Kroah-Hartman
On Mon, Sep 29, 2014 at 11:45:23AM +0200, Philipp Zabel wrote:
> Am Montag, den 29.09.2014, 12:13 +0300 schrieb Dan Carpenter:
> > On Mon, Sep 29, 2014 at 10:15:44AM +0200, Philipp Zabel wrote:
> > > In preparation for a following patch, stop decrementing the endpoint node
> > > refcount in the loop. This temporarily leaks a reference to the endpoint 
> > > node,
> > > which will be fixed by having of_graph_get_next_endpoint decrement the 
> > > refcount
> > > of its prev argument instead.
> > 
> > Don't do this...
> > 
> > My understanding (and I haven't invested much time into trying to
> > understand this beyond glancing at the change) is that patch 1 and 2,
> > introduce small bugs that are fixed in patch 3?
> >
> > Just fold all three patches into one patch.  We need an Ack from Mauro
> > and Greg and then send the patch through Grant's tree.
> 
> Yes. Patches 1 and 2 leak a reference on of_nodes touched by the loop.
> As far as I am aware, all users of this code don't use the reference
> counting (CONFIG_OF_DYNAMIC is disabled), so this bug should be
> theoretical.
> 
> I'd be happy do as you suggest if Mauro and Greg agree.

Let's see the correct patch, don't break things and then later on fix
them...

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 1/8] [media] soc_camera: Do not decrement endpoint node refcount in the loop

2014-09-29 Thread Philipp Zabel
Am Montag, den 29.09.2014, 12:13 +0300 schrieb Dan Carpenter:
> On Mon, Sep 29, 2014 at 10:15:44AM +0200, Philipp Zabel wrote:
> > In preparation for a following patch, stop decrementing the endpoint node
> > refcount in the loop. This temporarily leaks a reference to the endpoint 
> > node,
> > which will be fixed by having of_graph_get_next_endpoint decrement the 
> > refcount
> > of its prev argument instead.
> 
> Don't do this...
> 
> My understanding (and I haven't invested much time into trying to
> understand this beyond glancing at the change) is that patch 1 and 2,
> introduce small bugs that are fixed in patch 3?
>
> Just fold all three patches into one patch.  We need an Ack from Mauro
> and Greg and then send the patch through Grant's tree.

Yes. Patches 1 and 2 leak a reference on of_nodes touched by the loop.
As far as I am aware, all users of this code don't use the reference
counting (CONFIG_OF_DYNAMIC is disabled), so this bug should be
theoretical.

I'd be happy do as you suggest if Mauro and Greg agree.

regards
Philipp

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 1/8] [media] soc_camera: Do not decrement endpoint node refcount in the loop

2014-09-29 Thread Dan Carpenter
On Mon, Sep 29, 2014 at 10:15:44AM +0200, Philipp Zabel wrote:
> In preparation for a following patch, stop decrementing the endpoint node
> refcount in the loop. This temporarily leaks a reference to the endpoint node,
> which will be fixed by having of_graph_get_next_endpoint decrement the 
> refcount
> of its prev argument instead.

Don't do this...

My understanding (and I haven't invested much time into trying to
understand this beyond glancing at the change) is that patch 1 and 2,
introduce small bugs that are fixed in patch 3?

Just fold all three patches into one patch.  We need an Ack from Mauro
and Greg and then send the patch through Grant's tree.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/8] [media] soc_camera: Do not decrement endpoint node refcount in the loop

2014-09-29 Thread Philipp Zabel
In preparation for a following patch, stop decrementing the endpoint node
refcount in the loop. This temporarily leaks a reference to the endpoint node,
which will be fixed by having of_graph_get_next_endpoint decrement the refcount
of its prev argument instead.

Signed-off-by: Philipp Zabel 
---
Changes since v3:
 - Moved of_node_put for the break case after the loop
---
 drivers/media/platform/soc_camera/soc_camera.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/soc_camera/soc_camera.c 
b/drivers/media/platform/soc_camera/soc_camera.c
index f4308fe..619b2d4 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -1696,7 +1696,6 @@ static void scan_of_host(struct soc_camera_host *ici)
if (!i)
soc_of_bind(ici, epn, ren->parent);
 
-   of_node_put(epn);
of_node_put(ren);
 
if (i) {
@@ -1704,6 +1703,8 @@ static void scan_of_host(struct soc_camera_host *ici)
break;
}
}
+
+   of_node_put(epn);
 }
 
 #else
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html