From: Marcel Holtmann <marcel@holtmann.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Harald Welte <laforge@gnumonks.org>, linux-kernel@vger.kernel.org
Subject: [PATCH] Fix buffer overflow in Omnikey CardMan 4040 driver
Date: Tue, 06 Mar 2007 22:12:00 +0100 [thread overview]
Message-ID: <1173215520.15106.9.camel@aeonflux.holtmann.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 187 bytes --]
Hi Linus,
the attached patch fixes a buffer overflow in the Omnikey CardMan 4040
driver that could lead to a potential arbitrary code execution with
kernel privileges.
Regards
Marcel
[-- Attachment #2: patch-cardman-4040 --]
[-- Type: text/plain, Size: 1797 bytes --]
[PATCH] Fix buffer overflow in Omnikey CardMan 4040 driver (CVE-2007-0005)
Based on a patch from Don Howard <dhoward@redhat.com>
When calling write() with a buffer larger than 512 bytes, the
driver's write buffer overflows, allowing to overwrite the EIP and
execute arbitrary code with kernel privileges.
In read(), there exists a similar problem, but coming from the device.
A malicous or buggy device sending more than 512 bytes can overflow
of the driver's read buffer, with the same effects as above.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Harald Welte <laforge@gnumonks.org>
---
commit 5be3f29dbb70cf7b3eaa5e1be6dfa553c98ea1ad
tree 158eb27c16e372650d7bc8c6536b46f052932148
parent c3442e296517aee733d62fc3fe03211598902c7d
author Marcel Holtmann <marcel@holtmann.org> Tue, 06 Mar 2007 22:02:23 +0100
committer Marcel Holtmann <marcel@holtmann.org> Tue, 06 Mar 2007 22:02:23 +0100
drivers/char/pcmcia/cm4040_cs.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 0e82968..f2e4ec4 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -273,6 +273,7 @@ static ssize_t cm4040_read(struct file *filp, char __user *buf,
DEBUGP(6, dev, "BytesToRead=%lu\n", bytes_to_read);
min_bytes_to_read = min(count, bytes_to_read + 5);
+ min_bytes_to_read = min_t(size_t, min_bytes_to_read, READ_WRITE_BUFFER_SIZE);
DEBUGP(6, dev, "Min=%lu\n", min_bytes_to_read);
@@ -340,7 +341,7 @@ static ssize_t cm4040_write(struct file *filp, const char __user *buf,
return 0;
}
- if (count < 5) {
+ if ((count < 5) || (count > READ_WRITE_BUFFER_SIZE)) {
DEBUGP(2, dev, "<- cm4040_write buffersize=%Zd < 5\n", count);
return -EIO;
}
next reply other threads:[~2007-03-06 20:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-06 21:12 Marcel Holtmann [this message]
2007-03-06 20:21 ` Simon Arlott
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=1173215520.15106.9.camel@aeonflux.holtmann.net \
--to=marcel@holtmann.org \
--cc=laforge@gnumonks.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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®