public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] possible bug in inet->opt handling
@ 2011-04-15 15:39 Eric Dumazet
  2011-04-15 17:17 ` Herbert Xu
  2011-04-21 19:45 ` [PATCH] inet: add RCU protection to inet->opt Eric Dumazet
  0 siblings, 2 replies; 8+ messages in thread
From: Eric Dumazet @ 2011-04-15 15:39 UTC (permalink / raw)
  To: David Miller; +Cc: Herbert Xu, netdev

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 ?




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-04-28 20:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-15 15:39 [RFC] possible bug in inet->opt handling Eric Dumazet
2011-04-15 17:17 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox