diff options
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.patch | 53 |
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 @@ | |||
1 | From a2ee8c14e43a7432b50a050cd07c06d43caa9314 Mon Sep 17 00:00:00 2001 | ||
2 | From: Eric Dumazet <edumazet@google.com> | ||
3 | Date: Fri, 8 Jun 2012 06:25:00 +0000 | ||
4 | Subject: [PATCH 32/49] l2tp: fix a race in l2tp_ip_sendmsg() | ||
5 | |||
6 | [ Upstream commit 4399a4df98a63e30fd16e9d0cecc46ea92269e8f ] | ||
7 | |||
8 | Commit 081b1b1bb27f (l2tp: fix l2tp_ip_sendmsg() route handling) added | ||
9 | a race, in case IP route cache is disabled. | ||
10 | |||
11 | In this case, we should not do the dst_release(&rt->dst), since it'll | ||
12 | free the dst immediately, instead of waiting a RCU grace period. | ||
13 | |||
14 | Signed-off-by: Eric Dumazet <edumazet@google.com> | ||
15 | Cc: James Chapman <jchapman@katalix.com> | ||
16 | Cc: Denys Fedoryshchenko <denys@visp.net.lb> | ||
17 | Signed-off-by: David S. Miller <davem@davemloft.net> | ||
18 | Signed-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 | |||
23 | diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c | ||
24 | index 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 | -- | ||
52 | 1.7.10 | ||
53 | |||