diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2014-07-03 08:16:39 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-07-03 08:16:42 +0200 |
commit | 621266d3a4e8c70b305d3194080d6402ca97e1ac (patch) | |
tree | 25997e5842ebb1c8ae6411487e9c62d94e1be102 /fs | |
parent | 477199c68429b61b9471c4ed7dcadb406b5888f6 (diff) | |
download | barebox-621266d3a4e8c70b305d3194080d6402ca97e1ac.tar.gz barebox-621266d3a4e8c70b305d3194080d6402ca97e1ac.tar.xz |
automount: check for recursive automount
automount_mount calls run_command which may trigger an automount
again. This results in an endless loop. A simple way to trigger
this is:
mkdir /x; automount /x false; cd /x; something
Use a static variable to detect if we are currently in automount_mount()
and bail out if we are.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fs.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -409,6 +409,12 @@ static void automount_mount(const char *path, int instat) { struct automount *am; int ret; + static int in_automount; + + if (in_automount) + return; + + in_automount++; list_for_each_entry(am, &automount_list, list) { int len_path = strlen(path); @@ -444,8 +450,10 @@ static void automount_mount(const char *path, int instat) else automount_remove(am->path); - return; + break; } + + in_automount--; } BAREBOX_MAGICVAR(automount_path, "mountpath passed to automount scripts"); |