mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ronald S. Bultje" <R.S.Bultje@students.uu.nl>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org,
	Laurent Pinchart <laurent.pinchart@skynet.be>,
	Ken Ashcraft <kash@stanford.edu>
Subject: [PATCH/2.6.5] fix for potential integer overflow in zoran driver (was: [CHECKER] 21 probable missing bounds checks)
Date: Wed, 07 Apr 2004 20:47:54 +0200	[thread overview]
Message-ID: <1081363673.25529.29.camel@shrek.bitfreak.net> (raw)
In-Reply-To: <5.2.1.1.2.20040405173352.01be94b8@kash.pobox.stanford.edu>

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

Hi Andrew,

Attached patch fixes a potential integer overflow in zoran_procs.c (part
of the zr36067 driver). Bug was detected by Ken Ashcraft (see below),
you've probably received more of those.

Thanks to Ken for detecting.

Ronald

On Tue, 2004-04-06 at 02:45, Ken Ashcraft wrote:
> ---------------------------------------------------------
> [BUG]  vmalloc(count + 1) can overflow
> /home/kash/interface/linux-2.6.3/drivers/acpi/battery.c:591:acpi_battery_write_alarm: 
> NOTE:BOUND: Checking arg count [EXAMPLE=proc_dir_entry.write_proc-2]
> /home/kash/interface/linux-2.6.3/drivers/media/video/zoran_procfs.c:217:zoran_write_proc: 
> ERROR:BOUND: Not checking arg count [COUNTER=proc_dir_entry.write_proc-2] 
> [fit=2] [fit_fn=1] [fn_ex=0] [fn_counter=1] [ex=13] [counter=1] [z = 
> -0.367883603690978] [fn-z = -4.35889894354067]
>                          KERN_ERR
>                          "%s: write_proc: can not allocate memory\n",
>                          ZR_DEVNAME(zr));
>                  return -ENOMEM;
>          }
> 
> Error --->
>          if (copy_from_user(string, buffer, count)) {
>                  vfree (string);
>                  return -EFAULT;
>          }
> ---------------------------------------------------------

[-- Attachment #2: zoran-intbounds.patch --]
[-- Type: text/plain, Size: 414 bytes --]

--- linux-2.6.5/drivers/media/video/zoran_procfs.c-old	2004-04-07 20:41:59.000000000 +0200
+++ linux-2.6.5/drivers/media/video/zoran_procfs.c	2004-04-07 20:42:08.000000000 +0200
@@ -204,6 +204,10 @@
 	char *line, *ldelim, *varname, *svar, *tdelim;
 	struct zoran *zr;
 
+	/* Random maximum */
+	if (count > 256)
+		return -EINVAL;
+
 	zr = (struct zoran *) data;
 
 	string = sp = vmalloc(count + 1);

      reply	other threads:[~2004-04-08  0:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-06  0:45 [CHECKER] 21 probable missing bounds checks Ken Ashcraft
2004-04-07 18:47 ` Ronald S. Bultje [this message]

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=1081363673.25529.29.camel@shrek.bitfreak.net \
    --to=r.s.bultje@students.uu.nl \
    --cc=akpm@osdl.org \
    --cc=kash@stanford.edu \
    --cc=laurent.pinchart@skynet.be \
    --cc=linux-kernel@vger.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®