* [PATCH] V4L2: fix subdevice matching in asynchronous probing
@ 2013-04-19 14:41 Guennadi Liakhovetski
2013-04-22 10:34 ` Laurent Pinchart
0 siblings, 1 reply; 3+ messages in thread
From: Guennadi Liakhovetski @ 2013-04-19 14:41 UTC (permalink / raw)
To: Linux Media Mailing List; +Cc: Prabhakar Lad
A wrapped list iterating loop hasn't been correctly recognised in
v4l2_async_belongs(), which led to false positives. Fix the bug by
verifying the loop termination condition.
Reported-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
Prabhakar, please, check, whether this fixes your problem.
drivers/media/v4l2-core/v4l2-async.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index 5d6b428..5631944 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -76,6 +76,10 @@ static struct v4l2_async_subdev *v4l2_async_belongs(struct v4l2_async_notifier *
break;
}
+ if (&asd->list == ¬ifier->waiting)
+ /* Wrapped - no match found */
+ return NULL;
+
return asd;
}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] V4L2: fix subdevice matching in asynchronous probing
2013-04-19 14:41 [PATCH] V4L2: fix subdevice matching in asynchronous probing Guennadi Liakhovetski
@ 2013-04-22 10:34 ` Laurent Pinchart
2013-04-22 10:43 ` Guennadi Liakhovetski
0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2013-04-22 10:34 UTC (permalink / raw)
To: Guennadi Liakhovetski; +Cc: Linux Media Mailing List, Prabhakar Lad
Hi Guennadi,
On Friday 19 April 2013 16:41:02 Guennadi Liakhovetski wrote:
> A wrapped list iterating loop hasn't been correctly recognised in
> v4l2_async_belongs(), which led to false positives. Fix the bug by
> verifying the loop termination condition.
>
> Reported-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>
> Prabhakar, please, check, whether this fixes your problem.
>
> drivers/media/v4l2-core/v4l2-async.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/v4l2-async.c
> b/drivers/media/v4l2-core/v4l2-async.c index 5d6b428..5631944 100644
> --- a/drivers/media/v4l2-core/v4l2-async.c
> +++ b/drivers/media/v4l2-core/v4l2-async.c
> @@ -76,6 +76,10 @@ static struct v4l2_async_subdev
> *v4l2_async_belongs(struct v4l2_async_notifier *
> break;
> }
>
> + if (&asd->list == ¬ifier->waiting)
> + /* Wrapped - no match found */
> + return NULL;
> +
> return asd;
> }
What about just
if (match && match(sd->dev, hw))
return asd;
}
return NULL;
}
That's a bit simpler.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] V4L2: fix subdevice matching in asynchronous probing
2013-04-22 10:34 ` Laurent Pinchart
@ 2013-04-22 10:43 ` Guennadi Liakhovetski
0 siblings, 0 replies; 3+ messages in thread
From: Guennadi Liakhovetski @ 2013-04-22 10:43 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: Linux Media Mailing List, Prabhakar Lad
On Mon, 22 Apr 2013, Laurent Pinchart wrote:
> Hi Guennadi,
>
> On Friday 19 April 2013 16:41:02 Guennadi Liakhovetski wrote:
> > A wrapped list iterating loop hasn't been correctly recognised in
> > v4l2_async_belongs(), which led to false positives. Fix the bug by
> > verifying the loop termination condition.
> >
> > Reported-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > ---
> >
> > Prabhakar, please, check, whether this fixes your problem.
> >
> > drivers/media/v4l2-core/v4l2-async.c | 4 ++++
> > 1 files changed, 4 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/media/v4l2-core/v4l2-async.c
> > b/drivers/media/v4l2-core/v4l2-async.c index 5d6b428..5631944 100644
> > --- a/drivers/media/v4l2-core/v4l2-async.c
> > +++ b/drivers/media/v4l2-core/v4l2-async.c
> > @@ -76,6 +76,10 @@ static struct v4l2_async_subdev
> > *v4l2_async_belongs(struct v4l2_async_notifier *
> > break;
> > }
> >
> > + if (&asd->list == ¬ifier->waiting)
> > + /* Wrapped - no match found */
> > + return NULL;
> > +
> > return asd;
> > }
>
> What about just
>
> if (match && match(sd->dev, hw))
> return asd;
> }
>
> return NULL;
> }
>
> That's a bit simpler.
Well, if it were simpler, it would've occurred to me instead of the other
"more complex" solution, tight? ;-) No, sure, looks better, thanks! As
soon as the actual patches are approved in principle, I'll merge this into
them.
Regards
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-22 10:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-19 14:41 [PATCH] V4L2: fix subdevice matching in asynchronous probing Guennadi Liakhovetski
2013-04-22 10:34 ` Laurent Pinchart
2013-04-22 10:43 ` Guennadi Liakhovetski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox