public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	Dan Rosenberg <drosenberg@vsecurity.com>,
	Takashi Iwai <tiwai@suse.de>
Subject: [42/49] sound: Prevent buffer overflow in OSS load_mixer_volumes
Date: Wed, 05 Jan 2011 15:01:00 -0800	[thread overview]
Message-ID: <20110105230327.678299782@clark.site> (raw)
In-Reply-To: <20110105234415.GA22369@kroah.com>

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

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

From: Dan Rosenberg <drosenberg@vsecurity.com>

commit d81a12bc29ae4038770e05dce4ab7f26fd5880fb upstream.

The load_mixer_volumes() function, which can be triggered by
unprivileged users via the SOUND_MIXER_SETLEVELS ioctl, is vulnerable to
a buffer overflow.  Because the provided "name" argument isn't
guaranteed to be NULL terminated at the expected 32 bytes, it's possible
to overflow past the end of the last element in the mixer_vols array.
Further exploitation can result in an arbitrary kernel write (via
subsequent calls to load_mixer_volumes()) leading to privilege
escalation, or arbitrary kernel reads via get_mixer_levels().  In
addition, the strcmp() may leak bytes beyond the mixer_vols array.

Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 sound/oss/soundcard.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -87,7 +87,7 @@ int *load_mixer_volumes(char *name, int
 	int             i, n;
 
 	for (i = 0; i < num_mixer_volumes; i++) {
-		if (strcmp(name, mixer_vols[i].name) == 0) {
+		if (strncmp(name, mixer_vols[i].name, 32) == 0) {
 			if (present)
 				mixer_vols[i].num = i;
 			return mixer_vols[i].levels;
@@ -99,7 +99,7 @@ int *load_mixer_volumes(char *name, int
 	}
 	n = num_mixer_volumes++;
 
-	strcpy(mixer_vols[n].name, name);
+	strncpy(mixer_vols[n].name, name, 32);
 
 	if (present)
 		mixer_vols[n].num = n;



  parent reply	other threads:[~2011-01-05 23:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-05 23:44 [00/49] 2.6.32.28-longterm review (try 2) Greg KH
2011-01-05 23:00 ` [33/49] [SCSI] bfa: fix system crash when reading sysfs fc_host statistics Greg KH
2011-01-05 23:00 ` [34/49] igb: only use vlan_gro_receive if vlans are registered Greg KH
2011-01-26 22:37   ` Alexander Duyck
2011-01-05 23:00 ` [35/49] net: release dst entry while cache-hot for GSO case too Greg KH
2011-01-05 23:00 ` [36/49] install_special_mapping skips security_file_mmap check Greg KH
2011-01-05 23:00 ` [37/49] USB: misc: uss720.c: add another vendor/product ID Greg KH
2011-01-05 23:00 ` [38/49] USB: ftdi_sio: Add D.O.Tec PID Greg KH
2011-01-05 23:00 ` [39/49] USB: usb-storage: unusual_devs entry for the Samsung YP-CP3 Greg KH
2011-01-05 23:00 ` [40/49] p54usb: add 5 more USBIDs Greg KH
2011-01-05 23:00 ` [41/49] p54usb: New USB ID for Gemtek WUBI-100GW Greg KH
2011-01-05 23:01 ` Greg KH [this message]
2011-01-05 23:01 ` [43/49] mv_xor: fix race in tasklet function Greg KH
2011-01-05 23:01 ` [44/49] ima: fix add LSM rule bug Greg KH
2011-01-05 23:01 ` [45/49] ALSA: hda: Use LPIB for Dell Latitude 131L Greg KH
2011-01-05 23:01 ` [46/49] ALSA: hda: Use LPIB quirk for Dell Inspiron m101z/1120 Greg KH
2011-01-05 23:01 ` [47/49] block: Deprecate QUEUE_FLAG_CLUSTER and use queue_limits instead Greg KH
2011-01-05 23:01 ` [48/49] sctp: Fix a race between ICMP protocol unreachable and connect() Greg KH
2011-01-05 23:01 ` [49/49] posix-cpu-timers: workaround to suppress the problems with mt exec 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=20110105230327.678299782@clark.site \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=drosenberg@vsecurity.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=tiwai@suse.de \
    --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