firewall: fix a possible deadlock when the firewall config has syntax errors during...
authorJo-Philipp Wich <jow@openwrt.org>
Tue, 18 May 2010 20:15:47 +0000 (20:15 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Tue, 18 May 2010 20:15:47 +0000 (20:15 +0000)
SVN-Revision: 21501

package/firewall/files/lib/core.sh

index d0b87a770b8025a94b172eb7fe92f0b65cef2e2b..5f06ffe3fbe899a0764c28e8be4978442644f14a 100644 (file)
@@ -8,14 +8,15 @@ include /lib/network
 fw_start() {
        fw_init
 
-       lock /var/lock/firewall.start
-
        FW_DEFAULTS_APPLIED=
 
        fw_is_loaded && {
                echo "firewall already loaded" >&2
                exit 1
        }
+
+       lock /var/lock/firewall.start
+
        uci_set_state firewall core "" firewall_state
 
        fw_clear DROP
@@ -93,6 +94,7 @@ fw_die() {
        echo "Error:" "$@" >&2
        fw_log error "$@"
        fw_stop
+       lock -u /var/lock/firewall.start
        exit 1
 }