From patchwork Thu Nov 17 08:33:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li RongQing X-Patchwork-Id: 126158 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 C9989B6F9B for ; Thu, 17 Nov 2011 19:33:59 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752250Ab1KQIdz (ORCPT ); Thu, 17 Nov 2011 03:33:55 -0500 Received: from mail-iy0-f174.google.com ([209.85.210.174]:56558 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750828Ab1KQIdy (ORCPT ); Thu, 17 Nov 2011 03:33:54 -0500 Received: by iage36 with SMTP id e36so1788993iag.19 for ; Thu, 17 Nov 2011 00:33:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer; bh=bpzHlVEACotyN1KPgvGWh4ItN6rR9Gn6p4nrltK4Zao=; b=ipLSttnU5obGp+6gnridLu+WbE3/znVR3+PfAF4nqH8JhyN6LfiAZxvI91T2RwXyFu uMSmZuZBMJQT/gMo8cIZx3k1qZ+PFzxB6peFjwyqi34B/33sU41GPkH2tTAlhziv6By6 jiRmx8lMuu2Iwf/ia7hJ1Ctf7XXVX8xeGtpCc= Received: by 10.231.84.8 with SMTP id h8mr9617487ibl.47.1321518833609; Thu, 17 Nov 2011 00:33:53 -0800 (PST) Received: from localhost ([61.148.56.138]) by mx.google.com with ESMTPS id z10sm55174633ibv.9.2011.11.17.00.33.51 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Nov 2011 00:33:53 -0800 (PST) From: roy.qing.li@gmail.com To: netdev@vger.kernel.org Subject: [PATCH] ipv4: avoid to double release dst in tcp_v4_connect Date: Thu, 17 Nov 2011 16:33:48 +0800 Message-Id: <1321518828-4288-1-git-send-email-roy.qing.li@gmail.com> X-Mailer: git-send-email 1.7.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: RongQing.Li When tcp_connect failed in tcp_v4_connect, the dst will be released in error handler of tcp_v4_connect, but dst has been set to sk->sk_dst_cache which will be released again when destroy this sk. Signed-off-by: RongQing.Li --- net/ipv4/tcp_ipv4.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index a744315..adc2992 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -263,8 +263,10 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) err = tcp_connect(sk); rt = NULL; - if (err) + if (err) { + sk->sk_dst_cache = NULL; goto failure; + } return 0;