diff options
author | Nickolay V. Shmyrev <nshmyrev@yandex.ru> | 2005-12-01 03:51:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-12-01 18:48:57 -0500 |
commit | 50ab5edc973c979e8f620e09d20b96761d271894 (patch) | |
tree | 7be7c4416bb650c1c1c0d5845c2f0369e9956b35 /drivers | |
parent | 3b86b9999deb04bbfbb20e6b6fe1119a4bf0ff34 (diff) |
[PATCH] V4L: Fix read() bugs in bttv driver
Fix read() bugs in bttv driver.
Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Michael H. Schimek <mschimek@gmx.at>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/bttv-driver.c | 2 | ||||
-rw-r--r-- | drivers/media/video/video-buf.c | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 5bc522259d36..f9d581cd31db 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c | |||
@@ -2952,6 +2952,8 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
2952 | fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; | 2952 | fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; |
2953 | field = videobuf_next_field(&fh->cap); | 2953 | field = videobuf_next_field(&fh->cap); |
2954 | if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) { | 2954 | if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) { |
2955 | kfree (fh->cap.read_buf); | ||
2956 | fh->cap.read_buf = NULL; | ||
2955 | up(&fh->cap.lock); | 2957 | up(&fh->cap.lock); |
2956 | return POLLERR; | 2958 | return POLLERR; |
2957 | } | 2959 | } |
diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c index acfd3a103f35..bd34f81dbc69 100644 --- a/drivers/media/video/video-buf.c +++ b/drivers/media/video/video-buf.c | |||
@@ -753,10 +753,9 @@ videobuf_read_zerocopy(struct videobuf_queue *q, char __user *data, | |||
753 | int retval; | 753 | int retval; |
754 | 754 | ||
755 | /* setup stuff */ | 755 | /* setup stuff */ |
756 | retval = -ENOMEM; | ||
757 | q->read_buf = videobuf_alloc(q->msize); | 756 | q->read_buf = videobuf_alloc(q->msize); |
758 | if (NULL == q->read_buf) | 757 | if (NULL == q->read_buf) |
759 | goto done; | 758 | return -ENOMEM; |
760 | 759 | ||
761 | q->read_buf->memory = V4L2_MEMORY_USERPTR; | 760 | q->read_buf->memory = V4L2_MEMORY_USERPTR; |
762 | q->read_buf->baddr = (unsigned long)data; | 761 | q->read_buf->baddr = (unsigned long)data; |
@@ -819,8 +818,11 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
819 | q->read_buf->memory = V4L2_MEMORY_USERPTR; | 818 | q->read_buf->memory = V4L2_MEMORY_USERPTR; |
820 | field = videobuf_next_field(q); | 819 | field = videobuf_next_field(q); |
821 | retval = q->ops->buf_prepare(q,q->read_buf,field); | 820 | retval = q->ops->buf_prepare(q,q->read_buf,field); |
822 | if (0 != retval) | 821 | if (0 != retval) { |
822 | kfree (q->read_buf); | ||
823 | q->read_buf = NULL; | ||
823 | goto done; | 824 | goto done; |
825 | } | ||
824 | spin_lock_irqsave(q->irqlock,flags); | 826 | spin_lock_irqsave(q->irqlock,flags); |
825 | q->ops->buf_queue(q,q->read_buf); | 827 | q->ops->buf_queue(q,q->read_buf); |
826 | spin_unlock_irqrestore(q->irqlock,flags); | 828 | spin_unlock_irqrestore(q->irqlock,flags); |