@@ -223,8 +223,14 @@ int mptcp_pm_nl_announce_doit(struct sk_buff *skb, struct genl_info *info)
goto announce_err;
}
- if (addr_val.addr.id == 0 || !(addr_val.flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) {
- GENL_SET_ERR_MSG(info, "invalid addr id or flags");
+ if (addr_val.addr.id == 0) {
+ GENL_SET_ERR_MSG(info, "invalid addr id");
+ err = -EINVAL;
+ goto announce_err;
+ }
+
+ if (!(addr_val.flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) {
+ GENL_SET_ERR_MSG(info, "invalid addr flags");
err = -EINVAL;
goto announce_err;
}
@@ -531,8 +537,14 @@ int mptcp_pm_nl_subflow_destroy_doit(struct sk_buff *skb, struct genl_info *info
goto destroy_err;
}
- if (!addr_l.addr.port || !addr_r.port) {
- GENL_SET_ERR_MSG(info, "missing local or remote port");
+ if (!addr_l.addr.port) {
+ GENL_SET_ERR_MSG(info, "missing local port");
+ err = -EINVAL;
+ goto destroy_err;
+ }
+
+ if (!addr_r.port) {
+ GENL_SET_ERR_MSG(info, "missing remote port");
err = -EINVAL;
goto destroy_err;
}
@@ -580,13 +592,18 @@ int mptcp_userspace_pm_set_flags(struct sk_buff *skb, struct genl_info *info)
if (ret < 0)
goto set_flags_err;
+ if (loc.addr.family == AF_UNSPEC) {
+ GENL_SET_ERR_MSG(info, "invalid local address family");
+ ret = -EINVAL;
+ goto set_flags_err;
+ }
+
ret = mptcp_pm_parse_entry(attr_rem, info, false, &rem);
if (ret < 0)
goto set_flags_err;
- if (loc.addr.family == AF_UNSPEC ||
- rem.addr.family == AF_UNSPEC) {
- GENL_SET_ERR_MSG(info, "invalid address families");
+ if (rem.addr.family == AF_UNSPEC) {
+ GENL_SET_ERR_MSG(info, "invalid remote address family");
ret = -EINVAL;
goto set_flags_err;
}