relay: prevent integer overflow in relay_open()
svn path=/dists/trunk/linux-2.6/; revision=18694
This commit is contained in:
parent
0992284b23
commit
e44fa8a4b3
|
@ -28,6 +28,7 @@ linux-2.6 (3.2.6-1) UNRELEASED; urgency=low
|
||||||
[ Ben Hutchings ]
|
[ Ben Hutchings ]
|
||||||
* Change linux-image dependencies to allow kmod as an alternative to
|
* Change linux-image dependencies to allow kmod as an alternative to
|
||||||
module-init-tools
|
module-init-tools
|
||||||
|
* relay: prevent integer overflow in relay_open()
|
||||||
|
|
||||||
-- Bastian Blank <waldi@debian.org> Mon, 06 Feb 2012 11:22:07 +0100
|
-- Bastian Blank <waldi@debian.org> Mon, 06 Feb 2012 11:22:07 +0100
|
||||||
|
|
||||||
|
|
48
debian/patches/bugfix/all/relay-prevent-integer-overflow-in-relay_open.patch
vendored
Normal file
48
debian/patches/bugfix/all/relay-prevent-integer-overflow-in-relay_open.patch
vendored
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
From f6302f1bcd75a042df69866d98b8d775a668f8f1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Dan Carpenter <dan.carpenter@oracle.com>
|
||||||
|
Date: Fri, 10 Feb 2012 09:03:58 +0100
|
||||||
|
Subject: relay: prevent integer overflow in relay_open()
|
||||||
|
|
||||||
|
From: Dan Carpenter <dan.carpenter@oracle.com>
|
||||||
|
|
||||||
|
commit f6302f1bcd75a042df69866d98b8d775a668f8f1 upstream.
|
||||||
|
|
||||||
|
"subbuf_size" and "n_subbufs" come from the user and they need to be
|
||||||
|
capped to prevent an integer overflow.
|
||||||
|
|
||||||
|
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
|
||||||
|
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
||||||
|
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
|
||||||
|
---
|
||||||
|
kernel/relay.c | 10 ++++++++--
|
||||||
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
--- a/kernel/relay.c
|
||||||
|
+++ b/kernel/relay.c
|
||||||
|
@@ -164,10 +164,14 @@ depopulate:
|
||||||
|
*/
|
||||||
|
static struct rchan_buf *relay_create_buf(struct rchan *chan)
|
||||||
|
{
|
||||||
|
- struct rchan_buf *buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL);
|
||||||
|
- if (!buf)
|
||||||
|
+ struct rchan_buf *buf;
|
||||||
|
+
|
||||||
|
+ if (chan->n_subbufs > UINT_MAX / sizeof(size_t *))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
+ buf = kzalloc(sizeof(struct rchan_buf), GFP_KERNEL);
|
||||||
|
+ if (!buf)
|
||||||
|
+ return NULL;
|
||||||
|
buf->padding = kmalloc(chan->n_subbufs * sizeof(size_t *), GFP_KERNEL);
|
||||||
|
if (!buf->padding)
|
||||||
|
goto free_buf;
|
||||||
|
@@ -574,6 +578,8 @@ struct rchan *relay_open(const char *bas
|
||||||
|
|
||||||
|
if (!(subbuf_size && n_subbufs))
|
||||||
|
return NULL;
|
||||||
|
+ if (subbuf_size > UINT_MAX / n_subbufs)
|
||||||
|
+ return NULL;
|
||||||
|
|
||||||
|
chan = kzalloc(sizeof(struct rchan), GFP_KERNEL);
|
||||||
|
if (!chan)
|
|
@ -77,3 +77,4 @@
|
||||||
+ features/all/hwmon-it87-Add-IT8728F-support.patch
|
+ features/all/hwmon-it87-Add-IT8728F-support.patch
|
||||||
+ bugfix/arm/ARM-ixp4xx-mtd-oops.patch
|
+ bugfix/arm/ARM-ixp4xx-mtd-oops.patch
|
||||||
|
|
||||||
|
+ bugfix/all/relay-prevent-integer-overflow-in-relay_open.patch
|
||||||
|
|
Loading…
Reference in New Issue