From: Kishen Maloor <kishen.maloor@intel.com>
To: kishen.maloor@intel.com, mptcp@lists.linux.dev
Subject: [PATCH mptcp-next v2 2/3] Squash-to: mptcp: netlink: Add MPTCP_PM_CMD_REMOVE
Date: Wed, 20 Apr 2022 00:25:23 -0400 [thread overview]
Message-ID: <20220420042524.2268380-3-kishen.maloor@intel.com> (raw)
In-Reply-To: <20220420042524.2268380-1-kishen.maloor@intel.com>
Signed-off-by: Kishen Maloor <kishen.maloor@intel.com>
---
net/mptcp/pm_userspace.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
index a2de579ebd6d..bd8b692c60c4 100644
--- a/net/mptcp/pm_userspace.c
+++ b/net/mptcp/pm_userspace.c
@@ -189,12 +189,13 @@ int mptcp_nl_cmd_remove(struct sk_buff *skb, struct genl_info *info)
struct mptcp_pm_addr_entry *entry;
struct mptcp_sock *msk;
LIST_HEAD(free_list);
+ int err = -EINVAL;
u32 token_val;
u8 id_val;
if (!id || !token) {
GENL_SET_ERR_MSG(info, "missing required inputs");
- return -EINVAL;
+ return err;
}
id_val = nla_get_u8(id);
@@ -203,12 +204,12 @@ int mptcp_nl_cmd_remove(struct sk_buff *skb, struct genl_info *info)
msk = mptcp_token_get_sock(sock_net(skb->sk), token_val);
if (!msk) {
NL_SET_ERR_MSG_ATTR(info->extack, token, "invalid token");
- return -EINVAL;
+ return err;
}
if (!mptcp_pm_is_userspace(msk)) {
GENL_SET_ERR_MSG(info, "invalid request; userspace PM not selected");
- return -EINVAL;
+ goto remove_err;
}
lock_sock((struct sock *)msk);
@@ -223,7 +224,7 @@ int mptcp_nl_cmd_remove(struct sk_buff *skb, struct genl_info *info)
if (!match) {
GENL_SET_ERR_MSG(info, "address with specified id not found");
release_sock((struct sock *)msk);
- return -EINVAL;
+ goto remove_err;
}
list_move(&match->list, &free_list);
@@ -235,7 +236,11 @@ int mptcp_nl_cmd_remove(struct sk_buff *skb, struct genl_info *info)
list_for_each_entry_safe(match, entry, &free_list, list) {
sock_kfree_s((struct sock *)msk, match, sizeof(*match));
}
- return 0;
+
+ err = 0;
+ remove_err:
+ sock_put((struct sock *)msk);
+ return err;
}
int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info)
--
2.31.1
next prev parent reply other threads:[~2022-04-20 4:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-20 4:25 [PATCH mptcp-next v2 0/3] mptcp: fix bug in userspace PM APIs Kishen Maloor
2022-04-20 4:25 ` [PATCH mptcp-next v2 1/3] Squash-to: mptcp: netlink: Add MPTCP_PM_CMD_ANNOUNCE Kishen Maloor
2022-04-20 4:25 ` Kishen Maloor [this message]
2022-04-20 4:25 ` [PATCH mptcp-next v2 3/3] Squash-to: mptcp: netlink: allow userspace-driven subflow establishment Kishen Maloor
2022-04-20 6:17 ` Squash-to: mptcp: netlink: allow userspace-driven subflow establishment: Tests Results MPTCP CI
2022-04-20 15:22 ` [PATCH mptcp-next v2 0/3] mptcp: fix bug in userspace PM APIs Matthieu Baerts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220420042524.2268380-3-kishen.maloor@intel.com \
--to=kishen.maloor@intel.com \
--cc=mptcp@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox