From: Tomasz Stanislawski <t.stanislaws@samsung.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org, m.szyprowski@samsung.com,
kyungmin.park@samsung.com, hverkuil@xs4all.nl
Subject: Re: [PATCH 4/5] [media] v4l: fix copying ioctl results on failure
Date: Mon, 29 Aug 2011 10:01:58 +0200 [thread overview]
Message-ID: <4E5B4776.3030709@samsung.com> (raw)
In-Reply-To: <201108261709.02567.laurent.pinchart@ideasonboard.com>
On 08/26/2011 05:09 PM, Laurent Pinchart wrote:
Hi Laurent,
> Hi Tomasz,
>
> On Friday 26 August 2011 15:06:06 Tomasz Stanislawski wrote:
>> This patch fix the handling of data passed to V4L2 ioctls. The content of
>> the structures is not copied if the ioctl fails. It blocks ability to
>> obtain any information about occurred error other then errno code. This
>> patch fix this issue.
> Does the V4L2 spec say anything on this topic ? We might have applications
> that rely on the ioctl argument structure not being touched when a failure
> occurs.
Ups.. I missed something. It looks that modifying ioctl content is
illegal if ioctl fails. The spec says:
"When an ioctl that takes an output or read/write parameter fails, the
parameter remains unmodified." (v4l2 ioctl section)
However, there is probably a bug already present in V4L2 framework.
There are some ioctls that takes a pointer to an array as a field in the
argument struct.
The examples are all VIDIOC_*_EXT_CTRLS and VIDIOC_{QUERY/DQ/Q}_BUF family.
The content of such an auxiliary arays is copied even if ioctl fails.
Please take a look to video_usercopy function in v4l2-ioctl.c. Therefore
I think that the spec is already violated. What is your opinion about
this problem?
Now back to selection case.
This patch was added as proposition of fix to VIDIOC_S_SELECTION, to
return the best-hit rectangle if constraints could not be satisfied. The
ioctl return -ERANGE in this case. Using those return values the
application gets some feedback
on loosing constraints.
I could remove rectangle returning from the spec and s5p-tv code for now.
Regards,
Tomasz Stanislawski
>> Signed-off-by: Tomasz Stanislawski<t.stanislaws@samsung.com>
>> Signed-off-by: Kyungmin Park<kyungmin.park@samsung.com>
>> ---
>> drivers/media/video/v4l2-ioctl.c | 2 --
>> 1 files changed, 0 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/video/v4l2-ioctl.c
>> b/drivers/media/video/v4l2-ioctl.c index 543405b..9f54114 100644
>> --- a/drivers/media/video/v4l2-ioctl.c
>> +++ b/drivers/media/video/v4l2-ioctl.c
>> @@ -2490,8 +2490,6 @@ video_usercopy(struct file *file, unsigned int cmd,
>> unsigned long arg, err = -EFAULT;
>> goto out_array_args;
>> }
>> - if (err< 0)
>> - goto out;
>>
>> out_array_args:
>> /* Copy results into user buffer */
next prev parent reply other threads:[~2011-08-29 8:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-26 13:06 [PATCH v4 0/5] v4l: extended crop/compose api Tomasz Stanislawski
2011-08-26 13:06 ` [PATCH 1/5] [media] v4l: add support for selection api Tomasz Stanislawski
2011-08-26 14:57 ` Laurent Pinchart
2011-08-26 15:01 ` Laurent Pinchart
2011-08-30 18:38 ` Tomasz Stanislawski
2011-08-30 21:30 ` Sakari Ailus
2011-08-26 13:06 ` [PATCH 2/5] [media] v4l: add documentation for selection API Tomasz Stanislawski
2011-08-26 13:06 ` [PATCH 3/5] [media] v4l: simulate old crop API using extended crop/compose API Tomasz Stanislawski
2011-08-26 15:05 ` Laurent Pinchart
2011-09-27 9:30 ` Hans Verkuil
2011-09-28 10:27 ` Tomasz Stanislawski
2011-08-26 13:06 ` [PATCH 4/5] [media] v4l: fix copying ioctl results on failure Tomasz Stanislawski
2011-08-26 15:09 ` Laurent Pinchart
2011-08-29 8:01 ` Tomasz Stanislawski [this message]
2011-08-29 8:56 ` Laurent Pinchart
2011-08-29 11:55 ` Tomasz Stanislawski
2011-08-29 12:58 ` Laurent Pinchart
2011-08-26 13:06 ` [PATCH 5/5] [media] v4l: s5p-tv: mixer: add support for selection API Tomasz Stanislawski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E5B4776.3030709@samsung.com \
--to=t.stanislaws@samsung.com \
--cc=hverkuil@xs4all.nl \
--cc=kyungmin.park@samsung.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.