summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.23/0032-l2tp-fix-a-race-in-l2tp_ip_sendmsg.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.23/0032-l2tp-fix-a-race-in-l2tp_ip_sendmsg.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.23/0032-l2tp-fix-a-race-in-l2tp_ip_sendmsg.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.23/0032-l2tp-fix-a-race-in-l2tp_ip_sendmsg.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.23/0032-l2tp-fix-a-race-in-l2tp_ip_sendmsg.patch
new file mode 100644
index 00000000..60f8a9d5
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.23/0032-l2tp-fix-a-race-in-l2tp_ip_sendmsg.patch
@@ -0,0 +1,53 @@
1From a2ee8c14e43a7432b50a050cd07c06d43caa9314 Mon Sep 17 00:00:00 2001
2From: Eric Dumazet <edumazet@google.com>
3Date: Fri, 8 Jun 2012 06:25:00 +0000
4Subject: [PATCH 32/49] l2tp: fix a race in l2tp_ip_sendmsg()
5
6[ Upstream commit 4399a4df98a63e30fd16e9d0cecc46ea92269e8f ]
7
8Commit 081b1b1bb27f (l2tp: fix l2tp_ip_sendmsg() route handling) added
9a race, in case IP route cache is disabled.
10
11In this case, we should not do the dst_release(&rt->dst), since it'll
12free the dst immediately, instead of waiting a RCU grace period.
13
14Signed-off-by: Eric Dumazet <edumazet@google.com>
15Cc: James Chapman <jchapman@katalix.com>
16Cc: Denys Fedoryshchenko <denys@visp.net.lb>
17Signed-off-by: David S. Miller <davem@davemloft.net>
18Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
19---
20 net/l2tp/l2tp_ip.c | 9 ++++++---
21 1 file changed, 6 insertions(+), 3 deletions(-)
22
23diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
24index 2fbbe1f..6c7e609 100644
25--- a/net/l2tp/l2tp_ip.c
26+++ b/net/l2tp/l2tp_ip.c
27@@ -515,10 +515,12 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
28 sk->sk_bound_dev_if);
29 if (IS_ERR(rt))
30 goto no_route;
31- if (connected)
32+ if (connected) {
33 sk_setup_caps(sk, &rt->dst);
34- else
35- dst_release(&rt->dst); /* safe since we hold rcu_read_lock */
36+ } else {
37+ skb_dst_set(skb, &rt->dst);
38+ goto xmit;
39+ }
40 }
41
42 /* We dont need to clone dst here, it is guaranteed to not disappear.
43@@ -526,6 +528,7 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
44 */
45 skb_dst_set_noref(skb, &rt->dst);
46
47+xmit:
48 /* Queue the packet to IP for output */
49 rc = ip_queue_xmit(skb, &inet->cork.fl);
50 rcu_read_unlock();
51--
521.7.10
53