mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ralph Loader <suckfish@ihug.co.nz>
To: linux-uvc-devel <linux-uvc-devel@lists.berlios.de>
Cc: linux-kernel@vger.kernel.org
Subject: Buffer overflow in uvc-video.
Date: Sat, 20 Sep 2008 20:12:58 +1200	[thread overview]
Message-ID: <20080920201258.66c4c657@i.geek.nz> (raw)

Hi,

There appears to be a buffer overflow in
drivers/media/video/uvc/uvc_ctrl.c:

Sep 20 17:53:12 i kernel: BUG kmalloc-8 (Not tainted): Redzone
overwritten Sep 20 17:53:12 i kernel:
--------------------------------------------------------------------
--------- Sep 20 17:53:12 i kernel:
Sep 20 17:53:12 i kernel: INFO: 0xf2c5ce08-0xf2c5ce0b. First byte 0xa1
instead of 0xcc 
Sep 20 17:53:12 i kernel: INFO: Allocated in
uvc_query_v4l2_ctrl+0x3c/0x239 [uvcvideo] age=13 cpu=1 pid=4975
...


A fixed size 8-byte buffer is allocated, and a variable size field is
read into it; there is no particular bound on the size of the field
(it is dependent on hardware and configuration) and it can overflow
[also verified by inserting printk's.]

The patch below attempts to size the buffer to the correctly; I do not
know if sufficient validation of that size is carried out.

Cheers,
Ralph Loader.

diff --git a/drivers/media/video/uvc/uvc_ctrl.c
b/drivers/media/video/uvc/uvc_ct rl.c
index 6ef3e52..feab12a 100644
--- a/drivers/media/video/uvc/uvc_ctrl.c
+++ b/drivers/media/video/uvc/uvc_ctrl.c
@@ -592,7 +592,7 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device
*video, if (ctrl == NULL)
                return -EINVAL;
 
-       data = kmalloc(8, GFP_KERNEL);
+       data = kmalloc(ctrl->info->size, GFP_KERNEL);
        if (data == NULL)
                return -ENOMEM;
 

             reply	other threads:[~2008-09-20  8:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-20  8:12 Ralph Loader [this message]
2008-09-22 13:22 ` [Linux-uvc-devel] " 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=20080920201258.66c4c657@i.geek.nz \
    --to=suckfish@ihug.co.nz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-uvc-devel@lists.berlios.de \
    /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®