lkml.org 
[lkml]   [2014]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [v4 PATCH 1/1] init: fix race between rootfs mount and firmware loading
On 09/19, Roman Pen wrote:
>
> +void wait_for_rootfs(void)
> +{
> + /* Here we try to protect from a few things:
> + * 1. Avoid waiting for ourselves, when init thread has not
> + * mounted rootfs yet.
> + * 2. Avoid warning if call chain was initiated from userspace
> + * /sbin/init. For example when /sbin/init loads the driver,
> + * which, in turn, wants to access rootfs (e.g. firmware loading),
> + * thus it has to be sure, that rootfs has been successfully
> + * mounted.
> + */
> + if (rootfs_mounted || WARN_ON(is_global_init(current)))
> + return;
> + else
> + wait_event(rootfs_waitq, rootfs_mounted);
> +}

Well, in this case __wait_event() makes more sense, we already checked
rootfs_mounted, but this is minor.

Reviewed-by: Oleg Nesterov <oleg@redhat.com>


But I hope that Greg can take a look too. I do not understand the problem
space enough, so I am not sure this is the "right" fix. Say, perhaps we
should change the drivers which abuse request_firmware(), or do something
else.

Oleg.



\
 
 \ /
  Last update: 2014-09-19 22:21    [W:0.060 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site