From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
netdev <netdev@vger.kernel.org>
Subject: [RFC] possible bug in inet->opt handling
Date: Fri, 15 Apr 2011 17:39:54 +0200 [thread overview]
Message-ID: <1302881994.3613.34.camel@edumazet-laptop> (raw)
In commit 903ab86d19 (udp: Add lockless transmit path), we added a
fastpath to avoid taking socket lock if we dont use corking.
Prior work were commit 1c32c5ad6fac8c (inet: Add ip_make_skb and
ip_finish_skb) and commit 1470ddf7f8cecf776921e5 (inet: Remove explicit
write references to sk/inet in ip_append_data)
Problem is ip_make_skb() calls ip_setup_cork() and
ip_setup_cork() possibly makes a copy of ipc->opt (struct ip_options),
without any protection against another thread manipulating inet->opt.
Another thread can change inet->opt pointer and free old one... kaboom.
This was discovered by code analysis (I am trying to remove the zeroing
of cork variable in ip_make_skb(), since its a bit expensive and
probably useless)
Note : race was there before Herbert patches.
My plan is to add RCU protection on inet->opt, unless someone has better
idea ?
next reply other threads:[~2011-04-15 15:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-15 15:39 Eric Dumazet [this message]
2011-04-15 17:17 ` [RFC] possible bug in inet->opt handling Herbert Xu
2011-04-15 17:24 ` Herbert Xu
2011-04-21 19:45 ` [PATCH] inet: add RCU protection to inet->opt Eric Dumazet
2011-04-28 20:20 ` David Miller
2011-04-28 20:49 ` Eric Dumazet
2011-04-28 20:52 ` David Miller
2011-04-28 20:55 ` Eric Dumazet
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=1302881994.3613.34.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--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