netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guillaume Nault <gnault@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net] tcp: handle inet_csk_reqsk_queue_add() failures
Date: Fri, 8 Mar 2019 23:40:24 +0100	[thread overview]
Message-ID: <20190308224023.GA26735@pc-2.home> (raw)
In-Reply-To: <f29033e9-3cd4-99b4-3af9-7e1439a3f881@gmail.com>

On Fri, Mar 08, 2019 at 02:34:07PM -0800, Eric Dumazet wrote:
> 
> 
> On 03/08/2019 02:22 PM, Guillaume Nault wrote:
> > On Fri, Mar 08, 2019 at 01:33:02PM -0800, Eric Dumazet wrote:
> >>
> >>
> >> On 03/08/2019 01:09 PM, Guillaume Nault wrote:
> >>> @@ -216,7 +216,12 @@ struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb,
> >>>  		refcount_set(&req->rsk_refcnt, 1);
> >>>  		tcp_sk(child)->tsoffset = tsoff;
> >>>  		sock_rps_save_rxhash(child, skb);
> >>> -		inet_csk_reqsk_queue_add(sk, req, child);
> >>> +		if (!inet_csk_reqsk_queue_add(sk, req, child)) {
> >>> +			bh_unlock_sock(child);
> >>> +			sock_put(child);
> >>> +			child = NULL;
> >>> +			reqsk_put(req);
> >>
> >> Since we use reqsk_free(req) in the same function, we can use reqsk_free(req)
> >> here as well ?
> >>
> > That was my first approach, but reqsk_free() doesn't like it:
> > 
> > static inline void reqsk_free(struct request_sock *req)
> > {
> >         /* temporary debugging */
> > 	WARN_ON_ONCE(refcount_read(&req->rsk_refcnt) != 0);
> > ...
> > }
> 
> Oh right, there is this refcount_set(&req->rsk_refcnt, 1) before the call
> to inet_csk_reqsk_queue_add(sk, req, child);
> 
> So just change the TFO case only :)
> 
Well.. refcount is 1 in the TFO case too.

Long term, do we want to keep the WARN_ON_ONCE()? If so, we should
probably remove the comment.

  reply	other threads:[~2019-03-08 22:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-08 21:09 [PATCH net] tcp: handle inet_csk_reqsk_queue_add() failures Guillaume Nault
2019-03-08 21:33 ` Eric Dumazet
2019-03-08 22:22   ` Guillaume Nault
2019-03-08 22:34     ` Eric Dumazet
2019-03-08 22:40       ` Guillaume Nault [this message]
2019-03-08 23:47         ` Eric Dumazet
2019-03-09  0:06           ` David Miller
2019-03-09  9:02           ` Guillaume Nault

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=20190308224023.GA26735@pc-2.home \
    --to=gnault@redhat.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).