Hardware Environment: All
Software Environment: All
The comment above the body of do_acct_process() clearly states that it should
only be called from do_exit(). See the code extract below.
415 This function should only be called from
416 * do_exit().
420 * do_acct_process does all actual work. Caller holds the reference to file.
422 static void do_acct_process(struct file *file)
But in the following call chain, it is called from init, but never from do_exit.
do_acct_process <- acct_file_reopen <- sys_acct <- acct_auto_close <- sys_acct
<- do_umount <- do_remount_sb <- acct_auto_close <- do_umount <- sys_umount <-
sys_umount <- handle_initrd <- handle_initrd <- initrd_load <- initrd_load <-
prepare_namespace <- prepare_namespace <- init
Steps to reproduce:
I found this bug using a code checking tool.
I think the comment is somewhat ambiguous. It should probably say
"This function should only be called from do_exit() or when switching
to a different output file".
Maybe it originally precded acct_process() - and in that case, it would even
Is there any specific reason why you think this qualifies as a bug?
Thanks a lot for the explanation!
This was detected by a static checking tool. As the comment and code mismatch,
it is either a bug or the comment is wrong or imprecise.
In this case, as the comment is not correct, it may confuse and mislead
developers and cause new bugs. I've found bugs caused by reading bad comments.
ok, i've fixed the comment and have queued up a patch for upstream.