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,
	Takashi Iwai <tiwai@suse.de>
Subject: [01/11] ALSA: seq/oss - Fix double-free at error path of snd_seq_oss_open()
Date: Sat, 18 Sep 2010 11:44:57 -0700	[thread overview]
Message-ID: <20100918184620.980215356@clark.site> (raw)
In-Reply-To: <20100918184651.GA14224@kroah.com>

2.6.27-stable review patch.  If anyone has any objections, please let us know.

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

From: Takashi Iwai <tiwai@suse.de>

commit 27f7ad53829f79e799a253285318bff79ece15bd upstream.

The error handling in snd_seq_oss_open() has several bad codes that
do dereferecing released pointers and double-free of kmalloc'ed data.
The object dp is release in free_devinfo() that is called via
private_free callback.  The rest shouldn't touch this object any more.

The patch changes delete_port() to call kfree() in any case, and gets
rid of unnecessary calls of destructors in snd_seq_oss_open().

Fixes CVE-2010-3080.

Reported-and-tested-by: Tavis Ormandy <taviso@cmpxchg8b.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 sound/core/seq/oss/seq_oss_init.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

--- a/sound/core/seq/oss/seq_oss_init.c
+++ b/sound/core/seq/oss/seq_oss_init.c
@@ -280,13 +280,10 @@ snd_seq_oss_open(struct file *file, int
 	return 0;
 
  _error:
-	snd_seq_oss_writeq_delete(dp->writeq);
-	snd_seq_oss_readq_delete(dp->readq);
 	snd_seq_oss_synth_cleanup(dp);
 	snd_seq_oss_midi_cleanup(dp);
-	delete_port(dp);
 	delete_seq_queue(dp->queue);
-	kfree(dp);
+	delete_port(dp);
 
 	return rc;
 }
@@ -349,8 +346,10 @@ create_port(struct seq_oss_devinfo *dp)
 static int
 delete_port(struct seq_oss_devinfo *dp)
 {
-	if (dp->port < 0)
+	if (dp->port < 0) {
+		kfree(dp);
 		return 0;
+	}
 
 	debug_printk(("delete_port %i\n", dp->port));
 	return snd_seq_event_port_detach(dp->cseq, dp->port);



  reply	other threads:[~2010-09-18 18:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-18 18:46 [00/11] 2.6.27.54-stable review Greg KH
2010-09-18 18:44 ` Greg KH [this message]
2010-09-18 18:44 ` [02/11] ath9k_hw: fix parsing of HT40 5 GHz CTLs Greg KH
2010-09-18 18:44 ` [03/11] tracing: Do not allow llseek to set_ftrace_filter Greg KH
2010-09-18 18:45 ` [04/11] irda: off by one Greg KH
2010-09-18 18:45 ` [05/11] bounce: call flush_dcache_page() after bounce_copy_vec() Greg KH
2010-09-18 18:45 ` [06/11] x86-64, compat: Test %rax for the syscall number, not %eax Greg KH
2010-09-18 18:45 ` [07/11] compat: Make compat_alloc_user_space() incorporate the access_ok() Greg KH
2010-09-18 18:45 ` [08/11] hwmon: (f75375s) Shift control mode to the correct bit position Greg KH
2010-09-18 18:45 ` [09/11] hwmon: (f75375s) Do not overwrite values read from registers Greg KH
2010-09-18 18:45 ` [10/11] apm_power: Add missing break statement Greg KH
2010-09-18 18:45 ` [11/11] x86-64, compat: Retruncate rax after ia32 syscall entry tracing 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=20100918184620.980215356@clark.site \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --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