summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky@linux.intel.com>2008-12-10 13:32:58 -0800
committerInaky Perez-Gonzalez <inaky@linux.intel.com>2008-12-10 13:32:58 -0800
commitd31acadf06493c5930d4adb0ff946ea92cb43986 (patch)
tree8172d763bfd620b086e916f456fd692a8f329a56
parentae9ef831c2baa339c9c3362133e1f30fd54d8d4a (diff)
libwimaxll: fix policies for msg_to_user and re_state_change
Added missing policies to verify attr list in msg_to_user re_state_change Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
-rw-r--r--lib/op-msg.c6
-rw-r--r--lib/re-state-change.c15
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/op-msg.c b/lib/op-msg.c
index 4e51894..d1d03d6 100644
--- a/lib/op-msg.c
+++ b/lib/op-msg.c
@@ -124,6 +124,12 @@ struct nla_policy wimaxll_gnl_msg_from_user_policy[WIMAX_GNL_ATTR_MAX + 1] = {
[WIMAX_GNL_MSG_DATA] = {
.type = NLA_UNSPEC,
},
+ [WIMAX_GNL_MSG_IFIDX] = {
+ .type = NLA_U32,
+ },
+ [WIMAX_GNL_MSG_PIPE_NAME] = {
+ .type = NLA_STRING,
+ },
};
diff --git a/lib/re-state-change.c b/lib/re-state-change.c
index 7baab12..80f6bec 100644
--- a/lib/re-state-change.c
+++ b/lib/re-state-change.c
@@ -92,6 +92,7 @@
*/
static
struct nla_policy wimaxll_gnl_re_state_change_policy[WIMAX_GNL_ATTR_MAX + 1] = {
+ [WIMAX_GNL_STCH_IFIDX] = { .type = NLA_U32 },
[WIMAX_GNL_STCH_STATE_OLD] = { .type = NLA_U8 },
[WIMAX_GNL_STCH_STATE_NEW] = { .type = NLA_U8 },
};
@@ -142,6 +143,20 @@ int wimaxll_gnl_handle_state_change(struct wimaxll_handle *wmx,
result = NL_SKIP;
goto error_parse;
}
+ /* Find if the message is for the interface wmx represents */
+ if (tb[WIMAX_GNL_STCH_IFIDX] == NULL) {
+ wimaxll_msg(wmx, "E: %s: cannot find IFIDX attribute\n",
+ __func__);
+ wimaxll_cb_maybe_set_result(ctx, -ENODEV);
+ result = NL_SKIP;
+ goto error_no_attrs;
+
+ }
+ if (wmx->ifidx != nla_get_u32(tb[WIMAX_GNL_STCH_IFIDX])) {
+ result = NL_SKIP;
+ goto error_no_attrs;
+ }
+
if (tb[WIMAX_GNL_STCH_STATE_OLD] == NULL) {
wimaxll_msg(wmx, "E: %s: cannot find STCH_STATE_OLD "
"attribute\n", __func__);