From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: albcamus@gmail.com, parag.lkml@gmail.com,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] net: Fix sock_wfree() race
Date: Fri, 11 Sep 2009 11:43:37 -0700 (PDT) [thread overview]
Message-ID: <20090911.114337.150207703.davem@davemloft.net> (raw)
In-Reply-To: <4AA6DF7B.7060105@gmail.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 09 Sep 2009 00:49:31 +0200
> [PATCH] net: Fix sock_wfree() race
>
> Commit 2b85a34e911bf483c27cfdd124aeb1605145dc80
> (net: No more expensive sock_hold()/sock_put() on each tx)
> opens a window in sock_wfree() where another cpu
> might free the socket we are working on.
>
> Fix is to call sk->sk_write_space(sk) only
> while still holding a reference on sk.
>
> Since doing this call is done before the
> atomic_sub(truesize, &sk->sk_wmem_alloc), we should pass truesize as
> a bias for possible sk_wmem_alloc evaluations.
>
> Reported-by: Jike Song <albcamus@gmail.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied to net-next-2.6, thanks. I'll queue up your simpler
version for -stable.
BTW, if most if not all of the sock_writeable() calls are now
sock_writeable_bias(), it's probably better to just add the
bias argument to sock_writable().
And a quick grep shows that only a few plain sock_writeable()
calls remain in the less often used protocols.
next prev parent reply other threads:[~2009-09-11 18:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <alpine.DEB.2.00.0909072323350.3940@parag-desktop>
2009-09-08 4:51 ` BUG UNIX: Poison overwritten with 2.6.31-rc6-00223-g6c30c53 Jike Song
2009-09-08 7:38 ` Eric Dumazet
2009-09-08 8:09 ` Jike Song
2009-09-08 12:12 ` Eric Dumazet
2009-09-08 22:49 ` [PATCH] net: Fix sock_wfree() race Eric Dumazet
2009-09-09 7:14 ` Jike Song
2009-09-09 9:18 ` Eric Dumazet
2009-09-11 18:43 ` David Miller [this message]
2009-09-11 19:52 ` David Miller
2009-09-23 13:44 ` Eric Dumazet
2009-09-24 20:07 ` Jarek Poplawski
2009-09-24 20:49 ` Eric Dumazet
2009-09-30 23:23 ` David Miller
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=20090911.114337.150207703.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=albcamus@gmail.com \
--cc=eric.dumazet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=parag.lkml@gmail.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;
as well as URLs for NNTP newsgroup(s).