From: Horms <horms@verge.net.au>
To: Linux kernel <linux-kernel@vger.kernel.org>
Cc: Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
dannf@debian.org, micah@riseup.net
Subject: [PATCH, 2.4] wan sdla: fix probable security hole
Date: Thu, 5 Jan 2006 17:29:02 +0900 [thread overview]
Message-ID: <20060105082858.GA5872@verge.net.au> (raw)
In-Reply-To: <20060104130816.GA11280@informatik.uni-bremen.de>
> From: Chris Wright <chrisw@osdl.org>
> Date: Mon, 19 Apr 2004 08:26:30 +0000 (-0400)
> Subject: [PATCH] wan sdla: fix probable security hole
> X-Git-Tag: v2.6.6-rc2
> X-Git-Url: http://www.kernel.org/git/?p=linux/kernel/git/tglx/history.git;a=commitdiff;h=98cd917c1ac348d5cd94beabecc3011dcaa0a0f2
>
> [PATCH] wan sdla: fix probable security hole
>
> > [BUG] minor
> > /home/kash/linux/linux-2.6.5/drivers/net/wan/sdla.c:1206:sdla_xfer:
> > ERROR:TAINT: 1201:1206:Passing unbounded user value "(mem).len" as arg 0
> > to function "kmalloc", which uses it unsafely in model
> > [SOURCE_MODEL=(lib,copy_from_user,user,taintscalar)]
> > [SINK_MODEL=(lib,kmalloc,user,trustingsink)] [MINOR] [PATH=] [Also
> > used at, line 1219 in argument 0 to function "kmalloc"]
> > static int sdla_xfer(struct net_device *dev, struct sdla_mem *info, int
> > read)
> > {
> > struct sdla_mem mem;
> > char *temp;
> >
> > Start --->
> > if(copy_from_user(&mem, info, sizeof(mem)))
> > return -EFAULT;
> >
> > if (read)
> > {
> > Error --->
> > temp = kmalloc(mem.len, GFP_KERNEL);
> > if (!temp)
> > return(-ENOMEM);
> > sdla_read(dev, mem.addr, temp, mem.len);
>
> Hrm, I believe you could use this to read 128k of kernel memory.
> sdla_read() takes len as a short, whereas mem.len is an int. So,
> if mem.len == 0x20000, the allocation could still succeed. When cast
> to short, len will be 0x0, causing the read loop to copy nothing into
> the buffer. At least it's protected by a capable() check. I don't
> know what proper upper bound is for this hardware, or how much it's
> used/cared about. Simple memset() is trivial fix.
This seems to be applicable to 2.4
Signed-Off-By: Horms <horms@verge.net.au>
diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c
index 75fa993..fe74a21 100644
--- a/drivers/net/wan/sdla.c
+++ b/drivers/net/wan/sdla.c
@@ -1201,6 +1201,7 @@ static int sdla_xfer(struct net_device *
temp = kmalloc(mem.len, GFP_KERNEL);
if (!temp)
return(-ENOMEM);
+ memset(temp, 0, mem.len);
sdla_read(dev, mem.addr, temp, mem.len);
if(copy_to_user(mem.data, temp, mem.len))
{
parent reply other threads:[~2006-01-05 8:36 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20060104130816.GA11280@informatik.uni-bremen.de>]
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=20060105082858.GA5872@verge.net.au \
--to=horms@verge.net.au \
--cc=dannf@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.tosatti@cyclades.com \
--cc=micah@riseup.net \
/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®