mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
	uclinux-dist-devel@blackfin.uclinux.org, stable@kernel.org,
	David Howells <dhowells@redhat.com>,
	Bernd Schmidt <bernds_cb1@t-online.de>
Subject: [PATCH] FLAT: fix uninitialized ptr with shared libs
Date: Mon, 22 Jun 2009 15:35:32 -0400	[thread overview]
Message-ID: <1245699332-1872-1-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <alpine.LFD.2.01.0906221137580.3240@localhost.localdomain>

From: Bernd Schmidt <bernds_cb1@t-online.de>

The new credentials code broke load_flat_shared_library() as it now uses
an uninitialized cred pointer.

Signed-off-by: Bernd Schmidt <bernds_cb1@t-online.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: David Howells <dhowells@redhat.com>
---
should be cleaned up to apply to the master branch

 fs/binfmt_flat.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 697f6b5..33283cd 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -824,14 +824,23 @@ static int load_flat_shared_library(int id, struct lib_info *libs)
 	/* Open the file up */
 	bprm.filename = buf;
 	bprm.file = open_exec(bprm.filename);
+	bprm.cred = NULL;
 	res = PTR_ERR(bprm.file);
 	if (IS_ERR(bprm.file))
 		return res;
 
+	bprm.cred = prepare_exec_creds();
+	if (!bprm.cred)
+		goto out;
+
 	res = prepare_binprm(&bprm);
 
 	if (res <= (unsigned long)-4096)
 		res = load_flat_file(&bprm, libs, id, NULL);
+ out:
+	if (bprm.cred)
+		abort_creds(bprm.cred);
+
 	if (bprm.file) {
 		allow_write_access(bprm.file);
 		fput(bprm.file);
-- 
1.6.3.1


  parent reply	other threads:[~2009-06-22 19:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-22 10:36 Fix for shared flat binary format in 2.6.30 Bernd Schmidt
2009-06-22 18:44 ` Linus Torvalds
2009-06-22 18:56   ` Linus Torvalds
2009-06-22 19:35   ` Mike Frysinger [this message]
2009-06-22 20:48     ` [PATCH] FLAT: fix uninitialized ptr with shared libs Linus Torvalds
2009-06-22 21:00       ` [Uclinux-dist-devel] " Mike Frysinger
2009-06-23 10:14       ` Bernd Schmidt
2009-06-29 23:44         ` [stable] " Greg KH
2009-06-22 20:39   ` Fix for shared flat binary format in 2.6.30 John Stoffel
2009-06-22 21:06     ` Linus Torvalds
2009-06-23  1:59       ` John Stoffel
2009-06-23  2:44         ` Linus Torvalds
2009-06-25  7:12     ` Junio C Hamano

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=1245699332-1872-1-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=bernds_cb1@t-online.de \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=uclinux-dist-devel@blackfin.uclinux.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®