All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-2.6.32.y] sctp: unbalanced rcu lock in ip_queue_xmit()
@ 2013-11-08 10:13 Nicolas Dichtel
  2013-11-08 20:48 ` Willy Tarreau
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Dichtel @ 2013-11-08 10:13 UTC (permalink / raw)
  To: netdev, davem; +Cc: eric.dumazet, ben, w, stable, Nicolas Dichtel

The bug was introduced by commit b8710128e201 ("inet: add RCU protection to
inet->opt") (it's a backport of upstream commit f6d8bd051c39).

In SCTP case, packet is already routed, hence we jump to the label
'packet_routed', but without rcu_read_lock(). After this label,
rcu_read_unlock() is called unconditionally.

Spotted-by: Guo Fengtian <fengtian.guo@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 net/ipv4/ip_output.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 7dde039374e4..2cd69e3497ad 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -320,13 +320,13 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
 	/* Skip all of this if the packet is already routed,
 	 * f.e. by something like SCTP.
 	 */
+	rcu_read_lock();
 	rt = skb_rtable(skb);
 	if (rt != NULL)
 		goto packet_routed;
 
 	/* Make sure we can route this packet. */
 	rt = (struct rtable *)__sk_dst_check(sk, 0);
-	rcu_read_lock();
 	inet_opt = rcu_dereference(inet->inet_opt);
 	if (rt == NULL) {
 		__be32 daddr;
-- 
1.8.4.1

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

* Re: [PATCH linux-2.6.32.y] sctp: unbalanced rcu lock in ip_queue_xmit()
  2013-11-08 10:13 [PATCH linux-2.6.32.y] sctp: unbalanced rcu lock in ip_queue_xmit() Nicolas Dichtel
@ 2013-11-08 20:48 ` Willy Tarreau
  0 siblings, 0 replies; 2+ messages in thread
From: Willy Tarreau @ 2013-11-08 20:48 UTC (permalink / raw)
  To: Nicolas Dichtel; +Cc: netdev, davem, eric.dumazet, ben, stable

Hi Nicolas,

On Fri, Nov 08, 2013 at 11:13:55AM +0100, Nicolas Dichtel wrote:
> The bug was introduced by commit b8710128e201 ("inet: add RCU protection to
> inet->opt") (it's a backport of upstream commit f6d8bd051c39).
> 
> In SCTP case, packet is already routed, hence we jump to the label
> 'packet_routed', but without rcu_read_lock(). After this label,
> rcu_read_unlock() is called unconditionally.

I've just queued it for 2.6.32.62. Thanks!

Willy

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

end of thread, other threads:[~2013-11-08 20:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-08 10:13 [PATCH linux-2.6.32.y] sctp: unbalanced rcu lock in ip_queue_xmit() Nicolas Dichtel
2013-11-08 20:48 ` Willy Tarreau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.