mptcp: userspace pm: use a single point of exit
authorMatthieu Baerts <matthieu.baerts@tessares.net>
Wed, 25 Jan 2023 10:47:24 +0000 (11:47 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 26 Jan 2023 12:33:30 +0000 (13:33 +0100)
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>
net/mptcp/pm_userspace.c

index ea6ad9da749303a239f51702905bd11d34d5efed..a02d3cbf2a1b604a2ab65f4f11e98435023a18f2 100644 (file)
@@ -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;
@@ -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;
 }