[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100316193917.GD31632@redhat.com>
Date: Tue, 16 Mar 2010 20:39:17 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, andi@...stfloor.org,
David Howells <dhowells@...hat.com>,
Neil Horman <nhorman@...driver.com>,
Roland McGrath <roland@...hat.com>
Subject: [PATCH 3/4] coredump: factor out put_cred() calls
Given that do_coredump() calls put_cred() on exit path, it is a bit ugly
to do put_cred() + "goto fail" twice, just add the new "fail_creds" label.
Signed-off-by: Oleg Nesterov <oleg@...hat.com>
---
fs/exec.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
--- 34-rc1/fs/exec.c~3_CREDS 2010-03-16 18:09:13.000000000 +0100
+++ 34-rc1/fs/exec.c 2010-03-16 19:09:50.000000000 +0100
@@ -1859,10 +1859,8 @@ void do_coredump(long signr, int exit_co
goto fail;
cred = prepare_creds();
- if (!cred) {
- retval = -ENOMEM;
+ if (!cred)
goto fail;
- }
down_write(&mm->mmap_sem);
/*
@@ -1870,8 +1868,7 @@ void do_coredump(long signr, int exit_co
*/
if (mm->core_state || !__get_dumpable(cprm.mm_flags)) {
up_write(&mm->mmap_sem);
- put_cred(cred);
- goto fail;
+ goto fail_creds;
}
/*
@@ -1886,10 +1883,8 @@ void do_coredump(long signr, int exit_co
}
retval = coredump_wait(exit_code, &core_state);
- if (retval < 0) {
- put_cred(cred);
- goto fail;
- }
+ if (retval < 0)
+ goto fail_creds;
old_cred = override_creds(cred);
@@ -2006,9 +2001,10 @@ fail_dropcount:
if (ispipe)
atomic_dec(&core_dump_count);
fail_unlock:
+ coredump_finish(mm);
revert_creds(old_cred);
+fail_creds:
put_cred(cred);
- coredump_finish(mm);
fail:
return;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists