Skip to content

Commit 501ba8b

Browse files
Villemoesgregkh
authored andcommitted
devtmpfs: fix placement of complete() call
[ Upstream commit 38f087d ] Calling complete() from within the __init function is wrong - theoretically, the init process could proceed all the way to freeing the init mem before the devtmpfsd thread gets to execute the return instruction in devtmpfs_setup(). In practice, it seems to be harmless as gcc inlines devtmpfs_setup() into devtmpfsd(). So the calls of the __init functions init_chdir() etc. actually happen from devtmpfs_setup(), but the __ref on that one silences modpost (it's all right, because those calls happen before the complete()). But it does make the __init annotation of the setup function moot, which we'll fix in a subsequent patch. Fixes: bcbacc4 ("devtmpfs: refactor devtmpfsd()") Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Link: https://lore.kernel.org/r/20210312103027.2701413-1-linux@rasmusvillemoes.dk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent bac2031 commit 501ba8b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/base/devtmpfs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ static int __init devtmpfs_setup(void *p)
416416
init_chroot(".");
417417
out:
418418
*(int *)p = err;
419-
complete(&setup_done);
420419
return err;
421420
}
422421

@@ -429,6 +428,7 @@ static int __ref devtmpfsd(void *p)
429428
{
430429
int err = devtmpfs_setup(p);
431430

431+
complete(&setup_done);
432432
if (err)
433433
return err;
434434
devtmpfs_work_loop();

0 commit comments

Comments
 (0)