From patchwork Wed Oct 6 07:27:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmctWWloIFdhbmcgKOeOi+W0h+aHvyk=?= X-Patchwork-Id: 66898 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 88669B70AE for ; Wed, 6 Oct 2010 18:28:26 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932211Ab0JFH17 (ORCPT ); Wed, 6 Oct 2010 03:27:59 -0400 Received: from smtp-out.google.com ([74.125.121.35]:3991 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932112Ab0JFH16 (ORCPT ); Wed, 6 Oct 2010 03:27:58 -0400 Received: from wpaz29.hot.corp.google.com (wpaz29.hot.corp.google.com [172.24.198.93]) by smtp-out.google.com with ESMTP id o967Ru7W017979 for ; Wed, 6 Oct 2010 00:27:56 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1286350077; bh=9dRUtcVzolEp4ra/8+zuRUnv2EY=; h=MIME-Version:From:Date:Message-ID:Subject:To:Cc:Content-Type; b=EodH0A/ZCiSVa/2aqa++8RrjoztB8detlODRl5mqrqi/Jc19oP+lQHFxGOG2n/eA5 L3LUZ5y+QdMa3MHd5cALw== Received: from qwj9 (qwj9.prod.google.com [10.241.195.73]) by wpaz29.hot.corp.google.com with ESMTP id o967RR8q007844 for ; Wed, 6 Oct 2010 00:27:55 -0700 Received: by qwj9 with SMTP id 9so5500130qwj.10 for ; Wed, 06 Oct 2010 00:27:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:cc:content-type; bh=vjS/rBjnlN9T9GAWeVR4pCQsWKMrZAluvtNtvRki++Q=; b=xTgEbMWVz5frLxPfcFP3KmXik3MnZKcJZemXEjddElrg8rktaXynvfQi7ffFVKffxY IIIC4K32A0CfBPGcfnPw== DomainKey-Signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=mime-version:from:date:message-id:subject:to:cc:content-type; b=kvSF6ICbSajen65SOmS3oC8sZFYkPWdhFHqQeFD+bcKB6sWK62fUvIDISa8NYDWxHn 6L1OFPcSKPHIB/790keQ== Received: by 10.224.28.77 with SMTP id l13mr9124659qac.222.1286350075295; Wed, 06 Oct 2010 00:27:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.14.210 with HTTP; Wed, 6 Oct 2010 00:27:35 -0700 (PDT) From: =?UTF-8?B?Q2h1bmctWWloIFdhbmcgKOeOi+W0h+aHvyk=?= Date: Wed, 6 Oct 2010 00:27:35 -0700 Message-ID: Subject: [PATCH] net: Fix sk_dst_check() to reset the obsolete dst_entry of a socket. To: netdev Cc: linux-kernel@vger.kernel.org X-System-Of-Record: true Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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 netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);