mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
To: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] uvcvideo: Also validate buffers in BULK mode
Date: Mon, 09 Dec 2019 21:27:14 -0500	[thread overview]
Message-ID: <b30648712504dedd388ac13100afc43beba9408a.camel@collabora.com> (raw)
In-Reply-To: <20180605234607.5334-1-nicolas.dufresne@collabora.com>

[-- Attachment #1: Type: text/plain, Size: 1915 bytes --]

Le mardi 05 juin 2018 à 19:46 -0400, Nicolas Dufresne a écrit :
> Just like for ISOC, validate the decoded BULK buffer size when possible.
> This avoids sending corrupted or partial buffers to userspace, which may
> lead to application crash or run-time failure.
> 
> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

Ping. That was a year and a half ago and still applies.

> ---
>  drivers/media/usb/uvc/uvc_video.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> index aa0082fe5833..025ffac196f3 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -1234,6 +1234,7 @@ static void uvc_video_next_buffers(struct uvc_streaming *stream,
>  		*meta_buf = uvc_queue_next_buffer(&stream->meta.queue,
>  						  *meta_buf);
>  	}
> +	uvc_video_validate_buffer(stream, *video_buf);
>  	*video_buf = uvc_queue_next_buffer(&stream->queue, *video_buf);
>  }
>  
> @@ -1258,10 +1259,8 @@ static void uvc_video_decode_isoc(struct urb *urb, struct uvc_streaming *stream,
>  		do {
>  			ret = uvc_video_decode_start(stream, buf, mem,
>  				urb->iso_frame_desc[i].actual_length);
> -			if (ret == -EAGAIN) {
> -				uvc_video_validate_buffer(stream, buf);
> +			if (ret == -EAGAIN)
>  				uvc_video_next_buffers(stream, &buf, &meta_buf);
> -			}
>  		} while (ret == -EAGAIN);
>  
>  		if (ret < 0)
> @@ -1277,10 +1276,8 @@ static void uvc_video_decode_isoc(struct urb *urb, struct uvc_streaming *stream,
>  		uvc_video_decode_end(stream, buf, mem,
>  			urb->iso_frame_desc[i].actual_length);
>  
> -		if (buf->state == UVC_BUF_STATE_READY) {
> -			uvc_video_validate_buffer(stream, buf);
> +		if (buf->state == UVC_BUF_STATE_READY)
>  			uvc_video_next_buffers(stream, &buf, &meta_buf);
> -		}
>  	}
>  }
>  

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2019-12-10  2:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05  0:24 [PATCH] " Nicolas Dufresne
2018-06-05  8:52 ` Laurent Pinchart
2018-06-05 14:07   ` Nicolas Dufresne
2018-06-05 23:46   ` [PATCH v2] " Nicolas Dufresne
2019-12-10  2:27     ` Nicolas Dufresne [this message]
2019-12-10  2:30       ` Nicolas Dufresne
2019-12-13  0:12         ` Laurent Pinchart

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=b30648712504dedd388ac13100afc43beba9408a.camel@collabora.com \
    --to=nicolas.dufresne@collabora.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®