Commit 4b731d50ff3df6b9141a6c12b088e8eb0109e83c

Authored by Alexey Dobriyan
Committed by Linus Torvalds
1 parent 5443040754

bsdacct: fix uid/gid misreporting

commit d8e180dcd5bbbab9cd3ff2e779efcf70692ef541 "bsdacct: switch
credentials for writing to the accounting file" introduced credential
switching during final acct data collecting.  However, uid/gid pair
continued to be collected from current which became credentials of who
created acct file, not who exits.

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=14676

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Reported-by: Juho K. Juopperi <jkj@kapsi.fi>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Acked-by: David Howells <dhowells@redhat.com>
Reviewed-by: Michal Schmidt <mschmidt@redhat.com>
Cc: James Morris <jmorris@namei.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

... ... @@ -536,7 +536,8 @@
536 536 do_div(elapsed, AHZ);
537 537 ac.ac_btime = get_seconds() - elapsed;
538 538 /* we really need to bite the bullet and change layout */
539   - current_uid_gid(&ac.ac_uid, &ac.ac_gid);
  539 + ac.ac_uid = orig_cred->uid;
  540 + ac.ac_gid = orig_cred->gid;
540 541 #if ACCT_VERSION==2
541 542 ac.ac_ahz = AHZ;
542 543 #endif