mptcp: make sure flag signal is set when add addr with port
Subsystems (2)
PATCH 1/1 mptcp: make sure flag signal is set when add addr with port
From: Jianguo Wu <[email protected]>
When add address with port, it is mean to create a listening socket, and send an ADD_ADDR to remote, so it must have flag signal set, add this check in mptcp_pm_parse_addr().
Fixes 1729cf186d8a ("mptcp: create the listening socket for new port")
Signed-off-by Jianguo Wu <[email protected]>
--- net/mptcp/pm_netlink.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/mptcp/pm_netlink.c +7 -1
@@ -971,8 +971,14 @@ static int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info,if (tb[MPTCP_PM_ADDR_ATTR_FLAGS ]) entry->flags =nla_get_u32 (tb[MPTCP_PM_ADDR_ATTR_FLAGS ]); -if (tb[MPTCP_PM_ADDR_ATTR_PORT ]) +if (tb[MPTCP_PM_ADDR_ATTR_PORT ]) { +if (!(entry->flags &MPTCP_PM_ADDR_FLAG_SIGNAL )) { +NL_SET_ERR_MSG_ATTR (info->extack, attr, +"flags must have signal when using port" ); +return -EINVAL ; + } entry->addr.port =htons (nla_get_u16 (tb[MPTCP_PM_ADDR_ATTR_PORT ])); + }return 0 ; }
Signature · 1 line
1.8.3.1
Hi Jianguo,
Quoted 8 lines · Jianguo Wu <[email protected]> 于2021年4月23日周五 下午6:12写道:
From: Jianguo Wu <[email protected]>
When add address with port, it is mean to create a listening socket, and send an
ADD_ADDRto remote, so it must have flag signal set, add this check inmptcp_pm_parse_addr().Fixes 1729cf186d8a ("mptcp: create the listening socket for new port")
Fixes this one:
a77e9179c7651 ("mptcp: deal with MPTCP_PM_ADDR_ATTR_PORT in PM netlink")
Quoted 29 lines
Signed-off-by Jianguo Wu <[email protected]>--- net/mptcp/pm_netlink.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)net/mptcp/pm_netlink.c +7
-2@@ -971,8 +971,14 @@ static int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info,if (tb[MPTCP_PM_ADDR_ATTR_FLAGS ]) entry->flags =nla_get_u32 (tb[MPTCP_PM_ADDR_ATTR_FLAGS ]); -if (tb[MPTCP_PM_ADDR_ATTR_PORT ]) +if (tb[MPTCP_PM_ADDR_ATTR_PORT ]) { +if (!(entry->flags &MPTCP_PM_ADDR_FLAG_SIGNAL )) { +NL_SET_ERR_MSG_ATTR (info->extack, attr, +"flags must have signal when using port" ); +return -EINVAL ; + } entry->addr.port =htons (nla_get_u16 (tb[MPTCP_PM_ADDR_ATTR_PORT ])); + }return 0 ; } --1.8.3.1