mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
dccp/tcp: fix routing redirect race
am: 98933eb36d
Change-Id: I8a66a08fd74a7cd585eab307004983d71b26cbcd
This commit is contained in:
@@ -289,7 +289,8 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info)
|
||||
|
||||
switch (type) {
|
||||
case ICMP_REDIRECT:
|
||||
dccp_do_redirect(skb, sk);
|
||||
if (!sock_owned_by_user(sk))
|
||||
dccp_do_redirect(skb, sk);
|
||||
goto out;
|
||||
case ICMP_SOURCE_QUENCH:
|
||||
/* Just silently ignore these. */
|
||||
|
||||
@@ -122,10 +122,12 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
|
||||
np = inet6_sk(sk);
|
||||
|
||||
if (type == NDISC_REDIRECT) {
|
||||
struct dst_entry *dst = __sk_dst_check(sk, np->dst_cookie);
|
||||
if (!sock_owned_by_user(sk)) {
|
||||
struct dst_entry *dst = __sk_dst_check(sk, np->dst_cookie);
|
||||
|
||||
if (dst)
|
||||
dst->ops->redirect(dst, sk, skb);
|
||||
if (dst)
|
||||
dst->ops->redirect(dst, sk, skb);
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
@@ -421,7 +421,8 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
|
||||
|
||||
switch (type) {
|
||||
case ICMP_REDIRECT:
|
||||
do_redirect(icmp_skb, sk);
|
||||
if (!sock_owned_by_user(sk))
|
||||
do_redirect(icmp_skb, sk);
|
||||
goto out;
|
||||
case ICMP_SOURCE_QUENCH:
|
||||
/* Just silently ignore these. */
|
||||
|
||||
@@ -376,10 +376,12 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
|
||||
np = inet6_sk(sk);
|
||||
|
||||
if (type == NDISC_REDIRECT) {
|
||||
struct dst_entry *dst = __sk_dst_check(sk, np->dst_cookie);
|
||||
if (!sock_owned_by_user(sk)) {
|
||||
struct dst_entry *dst = __sk_dst_check(sk, np->dst_cookie);
|
||||
|
||||
if (dst)
|
||||
dst->ops->redirect(dst, sk, skb);
|
||||
if (dst)
|
||||
dst->ops->redirect(dst, sk, skb);
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user