diff options
author | Nickolay V. Shmyrev <devnull@localhost> | 2005-11-18 15:31:11 +0000 |
---|---|---|
committer | Nickolay V. Shmyrev <devnull@localhost> | 2005-11-18 15:31:11 +0000 |
commit | c56c9f23d7be223be81cbd7e9d6b6433628a78e8 (patch) | |
tree | 77331c92a910238f5138634dbfe426fdcec36275 /linux/drivers/media | |
parent | 4c9626ba54449b6c046e568c4bb5563580ac7df5 (diff) | |
download | mediapointer-dvb-s2-c56c9f23d7be223be81cbd7e9d6b6433628a78e8.tar.gz mediapointer-dvb-s2-c56c9f23d7be223be81cbd7e9d6b6433628a78e8.tar.bz2 |
Fix read() bugs in bttv driver.
From:
Signed-off-by: Nickolay V. Shmyrev <nshmyrev@yandex.ru>
Signed-off-by: Michael H. Schimek <mschimek@gmx.at>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/video/bttv-driver.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/video/video-buf.c | 10 |
2 files changed, 9 insertions, 5 deletions
diff --git a/linux/drivers/media/video/bttv-driver.c b/linux/drivers/media/video/bttv-driver.c index 351848e61..70a561602 100644 --- a/linux/drivers/media/video/bttv-driver.c +++ b/linux/drivers/media/video/bttv-driver.c @@ -1,5 +1,5 @@ /* - $Id: bttv-driver.c,v 1.69 2005/11/16 19:56:15 mchehab Exp $ + $Id: bttv-driver.c,v 1.70 2005/11/18 15:31:11 nsh Exp $ bttv - Bt848 frame grabber driver @@ -2980,6 +2980,8 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; field = videobuf_next_field(&fh->cap); if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) { + kfree (fh->cap.read_buf); + fh->cap.read_buf = NULL; up(&fh->cap.lock); return POLLERR; } diff --git a/linux/drivers/media/video/video-buf.c b/linux/drivers/media/video/video-buf.c index f200b2aa4..6d082f3ef 100644 --- a/linux/drivers/media/video/video-buf.c +++ b/linux/drivers/media/video/video-buf.c @@ -1,5 +1,5 @@ /* - * $Id: video-buf.c,v 1.21 2005/10/16 12:13:58 mchehab Exp $ + * $Id: video-buf.c,v 1.22 2005/11/18 15:31:12 nsh Exp $ * * generic helper functions for video4linux capture buffers, to handle * memory management and PCI DMA. Right now bttv + saa7134 use it. @@ -760,10 +760,9 @@ videobuf_read_zerocopy(struct videobuf_queue *q, char __user *data, int retval; /* setup stuff */ - retval = -ENOMEM; q->read_buf = videobuf_alloc(q->msize); if (NULL == q->read_buf) - goto done; + return -ENOMEM; q->read_buf->memory = V4L2_MEMORY_USERPTR; q->read_buf->baddr = (unsigned long)data; @@ -826,8 +825,11 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, q->read_buf->memory = V4L2_MEMORY_USERPTR; field = videobuf_next_field(q); retval = q->ops->buf_prepare(q,q->read_buf,field); - if (0 != retval) + if (0 != retval) { + kfree (q->read_buf); + q->read_buf = NULL; goto done; + } spin_lock_irqsave(q->irqlock,flags); q->ops->buf_queue(q,q->read_buf); spin_unlock_irqrestore(q->irqlock,flags); |