net: ipv4: tcp: Fix crash in tcp_nuke_addr

ip_route_output_key can return an ERR_PTR, don't dereference it.

Change-Id: I6b86a451b2bdb33873d79b3cf90c11dbe72bc081
Signed-off-by: Colin Cross <ccross@android.com>
This commit is contained in:
Colin Cross
2011-06-22 14:27:37 -07:00
parent af21159d1d
commit 99e01b39d9

View File

@@ -3334,7 +3334,7 @@ static int tcp_is_local(struct net *net, __be32 addr) {
struct rtable *rt;
struct flowi4 fl4 = { .daddr = addr };
rt = ip_route_output_key(net, &fl4);
if (!rt)
if (IS_ERR_OR_NULL(rt))
return 0;
return rt->dst.dev && (rt->dst.dev->flags & IFF_LOOPBACK);
}