netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: Fix sk_dst_check() to reset the obsolete dst_entry of a socket.
@ 2010-10-06  7:27 Chung-Yih Wang (王崇懿)
  2010-10-06  7:35 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Chung-Yih Wang (王崇懿) @ 2010-10-06  7:27 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel

    The issue is caused by the CL d11a4dc18bf41719c9f0d7ed494d295dd2973b92
    which will never reset the dst_entry of a socket if its current entry
    is freed(obsolete) for ipv4. This will block the socket's traffic
    instead of looking up a new dst_entry.

    Signed-off-by: Chung-yih Wang <cywang@google.com>
---
diff --git a/net/core/sock.c b/net/core/sock.c
index ef30e9d..b508819 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -382,7 +382,8 @@ struct dst_entry *__sk_dst_check(struct sock *sk,
u32 cookie)
 {
        struct dst_entry *dst = __sk_dst_get(sk);

-       if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) {
+       if (dst && dst->obsolete && ((dst->obsolete > 0) ||
+           (dst->ops->check(dst, cookie) == NULL))) {
                sk_tx_queue_clear(sk);
                rcu_assign_pointer(sk->sk_dst_cache, NULL);
                dst_release(dst);
@@ -397,7 +398,8 @@ struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie)
 {
        struct dst_entry *dst = sk_dst_get(sk);

-       if (dst && dst->obsolete && dst->ops->check(dst, cookie) == NULL) {
+       if (dst && dst->obsolete && ((dst->obsolete > 0) ||
+           (dst->ops->check(dst, cookie) == NULL))) {
                sk_dst_reset(sk);
                dst_release(dst);
                return NULL;

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

end of thread, other threads:[~2010-10-10  1:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-06  7:27 [PATCH] net: Fix sk_dst_check() to reset the obsolete dst_entry of a socket Chung-Yih Wang (王崇懿)
2010-10-06  7:35 ` David Miller
2010-10-06  7:47   ` Chung-Yih Wang (王崇懿)
2010-10-06  9:47     ` Chung-Yih Wang (王崇懿)
2010-10-07 19:37       ` Chung-Yih Wang (王崇懿)
2010-10-10  1:10         ` Chung-Yih Wang (王崇懿)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).