summaryrefslogtreecommitdiffstats
path: root/net/mptcp/pm_netlink.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2021-02-05 00:23:30 +0100
committerJakub Kicinski <kuba@kernel.org>2021-02-06 23:35:47 +0100
commit3abc05d9ef6fe989706b679e1e6371d6360d3db4 (patch)
tree5672614138e7851ae7d4a191bfd784085d16588c /net/mptcp/pm_netlink.c
parentselftests: mptcp: add command line arguments for mptcp_join.sh (diff)
downloadlinux-3abc05d9ef6fe989706b679e1e6371d6360d3db4.tar.xz
linux-3abc05d9ef6fe989706b679e1e6371d6360d3db4.zip
mptcp: pm: add lockdep assertions
Add a few assertions to make sure functions are called with the needed locks held. Two functions gain might_sleep annotations because they contain conditional calls to functions that sleep. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/mptcp/pm_netlink.c')
-rw-r--r--net/mptcp/pm_netlink.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index e7b1abb4f0c2..23780a13b934 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -145,6 +145,8 @@ select_local_address(const struct pm_nl_pernet *pernet,
struct mptcp_pm_addr_entry *entry, *ret = NULL;
struct sock *sk = (struct sock *)msk;
+ msk_owned_by_me(msk);
+
rcu_read_lock();
__mptcp_flush_join_list(msk);
list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) {
@@ -246,6 +248,8 @@ lookup_anno_list_by_saddr(struct mptcp_sock *msk,
{
struct mptcp_pm_add_entry *entry;
+ lockdep_assert_held(&msk->pm.lock);
+
list_for_each_entry(entry, &msk->pm.anno_list, list) {
if (addresses_equal(&entry->addr, addr, true))
return entry;
@@ -342,6 +346,8 @@ static bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,
struct sock *sk = (struct sock *)msk;
struct net *net = sock_net(sk);
+ lockdep_assert_held(&msk->pm.lock);
+
if (lookup_anno_list_by_saddr(msk, &entry->addr))
return false;
@@ -496,6 +502,9 @@ void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk)
{
struct mptcp_subflow_context *subflow;
+ msk_owned_by_me(msk);
+ lockdep_assert_held(&msk->pm.lock);
+
if (!mptcp_pm_should_add_signal(msk))
return;
@@ -566,6 +575,8 @@ void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk)
pr_debug("address rm_id %d", msk->pm.rm_id);
+ msk_owned_by_me(msk);
+
if (!msk->pm.rm_id)
return;
@@ -601,6 +612,8 @@ void mptcp_pm_nl_rm_subflow_received(struct mptcp_sock *msk, u8 rm_id)
pr_debug("subflow rm_id %d", rm_id);
+ msk_owned_by_me(msk);
+
if (!rm_id)
return;