Re: [PATCH] vb2: check if vb2_fop_write/read is allowed

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

 



On Tue, Mar 03, 2015 at 12:23:59PM +0100, Hans Verkuil wrote:
> Return -EINVAL if read() or write() is not supported by the queue. This
> makes it possible to provide both vb2_fop_read and vb2_fop_write in a
> struct v4l2_file_operations since the vb2_fop_* function will check if
> the file operation is allowed.
> 
> A similar check exists in __vb2_init_fileio() which is called from
> __vb2_perform_fileio(), but that check is only done if no file I/O is
> active. So the sequence of read() followed by write() would be allowed,
> which is obviously a bug.
> 
> In addition, vb2_fop_write/read should always return -EINVAL if the
> operation is not allowed, and by putting the check in the lower levels
> of the code it is possible that other error codes are returned (EBUSY
> or ERESTARTSYS).
> 
> All these issues are avoided by just doing a quick explicit check.
> 
> Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>

Acked-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>

-- 
Sakari Ailus
e-mail: sakari.ailus@xxxxxx	XMPP: sailus@xxxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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