On 5/8/25 2:48 AM, Mina Almasry wrote:
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 86c427f166367..0ae265d39184e 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -1059,6 +1059,7 @@ int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr 
> *msg, int *copied,
>  
>  int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)
>  {
> +     struct net_devmem_dmabuf_binding *binding = NULL;
>       struct tcp_sock *tp = tcp_sk(sk);
>       struct ubuf_info *uarg = NULL;
>       struct sk_buff *skb;
> @@ -1066,11 +1067,23 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr 
> *msg, size_t size)
>       int flags, err, copied = 0;
>       int mss_now = 0, size_goal, copied_syn = 0;
>       int process_backlog = 0;
> +     bool sockc_valid = true;
>       int zc = 0;
>       long timeo;
>  
>       flags = msg->msg_flags;
>  
> +     sockc = (struct sockcm_cookie){ .tsflags = READ_ONCE(sk->sk_tsflags) };
> +     if (msg->msg_controllen) {
> +             err = sock_cmsg_send(sk, msg, &sockc);
> +             if (unlikely(err))
> +                     /* Don't return error until MSG_FASTOPEN has been
> +                      * processed; that may succeed even if the cmsg is
> +                      * invalid.
> +                      */
> +                     sockc_valid = false;

It occurred to me a bit too late that this chunk of code could be
cleaned-up a bit using a 'sockc_err' variable to store the
sock_cmsg_send() return code instead of the 'sockc_valid' bool. It
should avoid a conditional here and in the later error check.

(just to mention a possible follow-up! no need to repost!)

Thanks,

Paolo


Reply via email to