Commit 8663707a authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by Willy Tarreau

sctp: unbalanced rcu lock in ip_queue_xmit()

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

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: default avatarGuo Fengtian <fengtian.guo@6wind.com>
Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent 8753987a
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment