stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Jens Axboe <axboe@kernel.dk>
Subject: [ 04/34] relay: prevent integer overflow in relay_open()
Date: Thu, 01 Mar 2012 13:39:26 -0800	[thread overview]
Message-ID: <20120301213922.870774296@linuxfoundation.org> (raw)
In-Reply-To: <20120301214654.GA13231@kroah.com>

2.6.32-longterm review patch.  If anyone has any objections, please let me know.

------------------

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
@@ -171,10 +171,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;
@@ -581,6 +585,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)



  parent reply	other threads:[~2012-03-01 21:39 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-01 21:46 [ 00/34] 2.6.32.58-longterm review Greg KH
2012-03-01 21:39 ` [ 01/34] drm/i915: no lvds quirk for AOpen MP45 Greg KH
2012-03-01 21:39 ` [ 02/34] hwmon: (f75375s) Fix bit shifting in f75375_write16 Greg KH
2012-03-01 21:39 ` [ 03/34] lib: proportion: lower PROP_MAX_SHIFT to 32 on 64-bit kernel Greg KH
2012-03-05 15:06   ` Jan Kara
2012-03-05 21:31     ` Fengguang Wu
2012-03-06 20:35       ` Jan Kara
2012-03-07  5:14         ` Fengguang Wu
2012-03-01 21:39 ` Greg KH [this message]
2012-03-01 21:39 ` [ 05/34] mac80211: timeout a single frame in the rx reorder buffer Greg KH
2012-03-01 21:39 ` [ 06/34] kernel.h: fix wrong usage of __ratelimit() Greg KH
2012-03-01 21:39 ` [ 07/34] printk_ratelimited(): fix uninitialized spinlock Greg KH
2012-03-01 21:39 ` [ 08/34] hwmon: (f75375s) Fix automatic pwm mode setting for F75373 & F75375 Greg KH
2012-03-01 21:39 ` [ 09/34] crypto: sha512 - Use binary and instead of modulus Greg KH
2012-03-01 21:39 ` [ 10/34] crypto: sha512 - Avoid stack bloat on i386 Greg KH
2012-03-01 21:39 ` [ 11/34] eCryptfs: Remove mmap from directory operations Greg KH
2012-03-01 21:39 ` [ 12/34] Ban ecryptfs over ecryptfs Greg KH
2012-03-01 21:39 ` [ 13/34] Add mount option to check uid of device being mounted = expect uid, CVE-2011-1833 Greg KH
2012-03-01 21:39 ` [ 14/34] crypto: sha512 - use standard ror64() Greg KH
2012-03-01 21:39 ` [ 15/34] drm/radeon/kms: fix MSI re-arm on rv370+ Greg KH
2012-03-01 21:39 ` [ 16/34] ecryptfs: read on a directory should return EISDIR if not supported Greg KH
2012-03-01 21:39 ` [ 17/34] SCSI: 3w-9xxx fix bug in sgl loading Greg KH
2012-03-01 21:39 ` [ 18/34] ARM: 7321/1: cache-v7: Disable preemption when reading CCSIDR Greg KH
2012-03-01 21:39 ` [ 19/34] ARM: 7325/1: fix v7 boot with lockdep enabled Greg KH
2012-03-01 21:39 ` [ 20/34] USB: Added Kamstrup VID/PIDs to cp210x serial driver Greg KH
2012-03-01 21:39 ` [ 21/34] USB: Fix handoff when BIOS disables host PCI device Greg KH
2012-03-01 21:39 ` [ 22/34] xhci: Fix encoding for HS bulk/control NAK rate Greg KH
2012-03-01 21:39 ` [ 23/34] [media] hdpvr: fix race conditon during start of streaming Greg KH
2012-03-01 21:39 ` [ 24/34] eCryptfs: Use notify_change for truncating lower inodes Greg KH
2012-03-01 21:39 ` [ 25/34] eCryptfs: Remove extra d_delete in ecryptfs_rmdir Greg KH
2012-03-01 21:39 ` [ 26/34] eCryptfs: Clear i_nlink in rmdir Greg KH
2012-03-01 21:39 ` [ 27/34] cdrom: use copy_to_user() without the underscores Greg KH
2012-03-01 21:39 ` [ 28/34] autofs: work around unhappy compat problem on x86-64 Greg KH
2012-03-01 21:39 ` [ 29/34] Fix autofs compile without CONFIG_COMPAT Greg KH
2012-03-01 21:39 ` [ 30/34] compat: fix compile breakage on s390 Greg KH
2012-03-01 21:39 ` [ 31/34] PM: Print a warning if firmware is requested when tasks are frozen Greg KH
2012-03-01 21:39 ` [ 32/34] firmware loader: allow builtin firmware load even if usermodehelper is disabled Greg KH
2012-03-01 21:39 ` [ 33/34] PM / Sleep: Fix freezer failures due to racy usermodehelper_is_disabled() Greg KH
2012-03-01 21:39 ` [ 34/34] PM / Sleep: Fix read_unlock_usermodehelper() call Greg KH
2012-03-02  7:19 ` [ 00/34] 2.6.32.58-longterm review Willy Tarreau
2012-03-02 13:51   ` Stefan Bader
2012-03-02 15:37   ` Greg KH

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=20120301213922.870774296@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=axboe@kernel.dk \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).