[PATCH] net: Fix sk_dst_check() to reset the obsolete dst_entry of a socket.

From: Chung-Yih Wang (çåæ)
Date: Wed Oct 06 2010 - 03:28:03 EST


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@xxxxxxxxxx>
---
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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/