public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Damato <jdamato@fastly.com>
To: Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: horms@kernel.org, davem@davemloft.net, donald.hunter@redhat.com,
	edumazet@google.com, kuba@kernel.org, kuni1840@gmail.com,
	netdev@vger.kernel.org, pabeni@redhat.com
Subject: Re: [PATCH v1 net-next 06/12] af_unix: Reuse out_pipe label in unix_stream_sendmsg().
Date: Fri, 10 Jan 2025 13:58:39 -0800	[thread overview]
Message-ID: <Z4GYD_9dqOi7mXOj@LQ3V64L9R2> (raw)
In-Reply-To: <20250110152231.38703-1-kuniyu@amazon.com>

On Sat, Jan 11, 2025 at 12:22:31AM +0900, Kuniyuki Iwashima wrote:
> From: Simon Horman <horms@kernel.org>
> Date: Fri, 10 Jan 2025 11:43:44 +0000
> > On Fri, Jan 10, 2025 at 06:26:35PM +0900, Kuniyuki Iwashima wrote:
> > > This is a follow-up of commit d460b04bc452 ("af_unix: Clean up
> > > error paths in unix_stream_sendmsg().").
> > > 
> > > If we initialise skb with NULL in unix_stream_sendmsg(), we can
> > > reuse the existing out_pipe label for the SEND_SHUTDOWN check.
> > > 
> > > Let's rename do it and adjust the existing label as out_pipe_lock.
> > > 
> > > While at it, size and data_len are moved to the while loop scope.
> > > 
> > > Suggested-by: Paolo Abeni <pabeni@redhat.com>
> > > Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> > > ---
> > >  net/unix/af_unix.c | 23 +++++++++--------------
> > >  1 file changed, 9 insertions(+), 14 deletions(-)
> > > 
> > > diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> > > index b190ea8b8e9d..6505eeab9957 100644
> > > --- a/net/unix/af_unix.c
> > > +++ b/net/unix/af_unix.c
> > 
> > ...
> > 
> > > @@ -2285,16 +2283,12 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,
> > >  		}
> > >  	}
> > >  
> > > -	if (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN) {
> > > -		if (!(msg->msg_flags & MSG_NOSIGNAL))
> > > -			send_sig(SIGPIPE, current, 0);
> > > -
> > > -		err = -EPIPE;
> > > -		goto out_err;
> > > -	}
> > > +	if (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN)
> > 
> > Hi Iwashima-san,
> > 
> > I think you need to set reason here.
> > 
> > Flagged by W=1 builds with clang-19.
> 
> Hi Simon,
> 
> I didn't set it here because skb == NULL and kfree_skb()
> doesn't touch reason, and KMSAN won't complain about uninit.
> 
> Should I use SKB_NOT_DROPPED_YET or drop patch 6 or leave
> it as is ?
> 
> What do you think ?

My vote is that SKB_NOT_DROPPED_YET is not appropriate here.

Maybe SKB_DROP_REASON_SOCKET_CLOSE since it is in SEND_SHUTDOWN
state?

  reply	other threads:[~2025-01-10 21:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-10  9:26 [PATCH v1 net-next 00/12] af_unix: Set skb drop reason in every kfree_skb() path Kuniyuki Iwashima
2025-01-10  9:26 ` [PATCH v1 net-next 01/12] net: dropreason: Gather SOCKET_ drop reasons Kuniyuki Iwashima
2025-01-10  9:26 ` [PATCH v1 net-next 02/12] af_unix: Set drop reason in unix_release_sock() Kuniyuki Iwashima
2025-01-10  9:26 ` [PATCH v1 net-next 03/12] af_unix: Set drop reason in unix_sock_destructor() Kuniyuki Iwashima
2025-01-10  9:26 ` [PATCH v1 net-next 04/12] af_unix: Set drop reason in __unix_gc() Kuniyuki Iwashima
2025-01-10  9:26 ` [PATCH v1 net-next 05/12] af_unix: Set drop reason in unix_stream_connect() Kuniyuki Iwashima
2025-01-10  9:26 ` [PATCH v1 net-next 06/12] af_unix: Reuse out_pipe label in unix_stream_sendmsg() Kuniyuki Iwashima
2025-01-10 11:43   ` Simon Horman
2025-01-10 15:22     ` Kuniyuki Iwashima
2025-01-10 21:58       ` Joe Damato [this message]
2025-01-11  3:43         ` Kuniyuki Iwashima
2025-01-10  9:26 ` [PATCH v1 net-next 07/12] af_unix: Set drop reason " Kuniyuki Iwashima
2025-01-11  9:49   ` kernel test robot
2025-01-10  9:26 ` [PATCH v1 net-next 08/12] af_unix: Set drop reason in queue_oob() Kuniyuki Iwashima
2025-01-10  9:26 ` [PATCH v1 net-next 09/12] af_unix: Set drop reason in manage_oob() Kuniyuki Iwashima
2025-01-10  9:26 ` [PATCH v1 net-next 10/12] af_unix: Set drop reason in unix_stream_read_skb() Kuniyuki Iwashima
2025-01-10  9:26 ` [PATCH v1 net-next 11/12] af_unix: Set drop reason in unix_dgram_disconnected() Kuniyuki Iwashima
2025-01-10  9:26 ` [PATCH v1 net-next 12/12] af_unix: Set drop reason in unix_dgram_sendmsg() Kuniyuki Iwashima

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z4GYD_9dqOi7mXOj@LQ3V64L9R2 \
    --to=jdamato@fastly.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@redhat.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@amazon.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox