summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2014-07-29 18:41:51 +0200
committerSteven Barth <steven@midlink.org>2014-07-29 18:41:51 +0200
commite1ec2d2b9e7f7692a4ff88a0361bbcdbe34f0d99 (patch)
tree42e78bb118c9be7309919f7844329e852d02141d
parent7b81300f7329a7c815dc8543c1a50febddfa6632 (diff)
proto-shell: extend race condition avoidance
Disallow all notifications from the proto handler during teardown to avoid the shell proto state being reset to S_IDLE and the interface hanging in IFS_TEARDOWN state. Signed-off-by: Steven Barth <steven@midlink.org>
-rw-r--r--proto-shell.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/proto-shell.c b/proto-shell.c
index 77c9b87..98f5e52 100644
--- a/proto-shell.c
+++ b/proto-shell.c
@@ -444,7 +444,7 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr *data,
return UBUS_STATUS_INVALID_ARGUMENT;
up = blobmsg_get_bool(tb[NOTIFY_LINK_UP]);
- if (!up || state->sm == S_TEARDOWN) {
+ if (!up) {
state->proto.proto_event(&state->proto, IFPEV_LINK_LOST);
return 0;
}
@@ -695,6 +695,9 @@ proto_shell_notify(struct interface_proto_state *proto, struct blob_attr *attr)
if (!tb[NOTIFY_ACTION])
return UBUS_STATUS_INVALID_ARGUMENT;
+ if (state->sm == S_TEARDOWN || state->sm == S_SETUP_ABORT)
+ return UBUS_STATUS_PERMISSION_DENIED;
+
switch(blobmsg_get_u32(tb[NOTIFY_ACTION])) {
case 0:
return proto_shell_update_link(state, attr, tb);