Skip to content

Commit

Permalink
af_unix: Split restart label in unix_dgram_sendmsg().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kuniyuki Iwashima authored and Paolo Abeni committed Dec 17, 2024
1 parent 3c05329 commit a700b43
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/unix/af_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -2059,6 +2059,7 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
goto out_free;
}

restart:
sk_locked = 0;
unix_state_lock(other);
restart_locked:
Expand Down Expand Up @@ -2106,7 +2107,8 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
other = NULL;
if (err)
goto out_free;
goto restart;

goto lookup;
}

if (other->sk_shutdown & RCV_SHUTDOWN) {
Expand Down

0 comments on commit a700b43

Please sign in to comment.