From: Oleg Nesterov on 16 Mar 2010 15:50 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(a)redhat.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(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
Pages: 1 Prev: [PATCH 4/4] coredump: shift down_write(mmap_sem) into coredump_wait() Next: regression? |