Skip to content

Commit

Permalink
mptcp: userspace pm: use a single point of exit
Browse files Browse the repository at this point in the history
Like in all other functions in this file, a single point of exit is used
when extra operations are needed: unlock, decrement refcount, etc.

There is no functional change for the moment but it is better to do the
same here to make sure all cleanups are done in case of intermediate
errors.

Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Matthieu Baerts authored and Paolo Abeni committed Jan 26, 2023
1 parent ad34937 commit 40c71f7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/mptcp/pm_userspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,
*/
e = sock_kmalloc(sk, sizeof(*e), GFP_ATOMIC);
if (!e) {
spin_unlock_bh(&msk->pm.lock);
return -ENOMEM;
ret = -ENOMEM;
goto append_err;
}

*e = *entry;
Expand All @@ -74,6 +74,7 @@ int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,
ret = entry->addr.id;
}

append_err:
spin_unlock_bh(&msk->pm.lock);
return ret;
}
Expand Down

0 comments on commit 40c71f7

Please sign in to comment.