]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
af_unix: Split restart label in unix_dgram_sendmsg().
authorKuniyuki Iwashima <kuniyu@amazon.com>
Fri, 13 Dec 2024 11:08:46 +0000 (20:08 +0900)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 17 Dec 2024 11:08:28 +0000 (12:08 +0100)
There are two paths jumping to the restart label in unix_dgram_sendmsg().

One requires another lookup and sk_filter(), but the other doesn't.

Let's split the label to make each flow more straightforward.

Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/unix/af_unix.c

index ae74fdcf5dcd1d23e008b422b73f810e47a58e1b..513d0fd12e6a974bae720b0985e511a9aeff2ae3 100644 (file)
@@ -2042,8 +2042,8 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
 
        timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
 
-restart:
        if (!other) {
+lookup:
                other = unix_find_other(sock_net(sk), msg->msg_name,
                                        msg->msg_namelen, sk->sk_type);
                if (IS_ERR(other)) {
@@ -2059,6 +2059,7 @@ restart:
                goto out_free;
        }
 
+restart:
        sk_locked = 0;
        unix_state_lock(other);
 restart_locked:
@@ -2106,7 +2107,8 @@ restart_locked:
                other = NULL;
                if (err)
                        goto out_free;
-               goto restart;
+
+               goto lookup;
        }
 
        if (other->sk_shutdown & RCV_SHUTDOWN) {