From: Linus Torvalds <torvalds@linux-foundation.org>
To: Mike Frysinger <vapier@gentoo.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: Re: [PATCH] FLAT: fix uninitialized ptr with shared libs
Date: Mon, 22 Jun 2009 13:48:44 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.2.01.0906221338360.3240@localhost.localdomain> (raw)
In-Reply-To: <1245699332-1872-1-git-send-email-vapier@gentoo.org>
On Mon, 22 Jun 2009, Mike Frysinger wrote:
>
> should be cleaned up to apply to the master branch
Hmm. Can somebody explain why we even bother to test bprm.cred for NULL
that second time?
Or why we test bprm.file, for that matter? How could it possibly suddenly
become NULL?
Finally, if that bprm.cred _is_ NULL in the first test, then 'res' will be
NULL (from the previous statement), and with the "goto out" we'll return
_success_ from this function when we failed to allocate a cred.
IOW, the whole patch really seems to be total and utter crap. Why didn't
people spend a bit more effort lookin at it?
IOW, shouldn't the patch be something like the appended?
UNTESTED. I did not compile this, or the previous patch. I have not tried
it. I'm not going to commit it. I'm hoping to get a patch back that is
tested and/or explains my concerns with the previous one..
Linus
---
fs/binfmt_flat.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 697f6b5..e92f229 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -828,15 +828,22 @@ static int load_flat_shared_library(int id, struct lib_info *libs)
if (IS_ERR(bprm.file))
return res;
+ bprm.cred = prepare_exec_creds();
+ res = -ENOMEM;
+ if (!bprm.cred)
+ goto out;
+
res = prepare_binprm(&bprm);
if (res <= (unsigned long)-4096)
res = load_flat_file(&bprm, libs, id, NULL);
- if (bprm.file) {
- allow_write_access(bprm.file);
- fput(bprm.file);
- bprm.file = NULL;
- }
+
+ abort_creds(bprm.cred);
+
+out:
+ allow_write_access(bprm.file);
+ fput(bprm.file);
+
return(res);
}
next prev parent reply other threads:[~2009-06-22 20:52 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 ` [PATCH] FLAT: fix uninitialized ptr with shared libs Mike Frysinger
2009-06-22 20:48 ` Linus Torvalds [this message]
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=alpine.LFD.2.01.0906221338360.3240@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=bernds_cb1@t-online.de \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@kernel.org \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
--cc=vapier@gentoo.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®