From patchwork Thu Apr 18 21:37:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jesper Dangaard Brouer X-Patchwork-Id: 237745 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 035982C0205 for ; Fri, 19 Apr 2013 07:35:01 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936039Ab3DRVe5 (ORCPT ); Thu, 18 Apr 2013 17:34:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24692 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751823Ab3DRVe5 (ORCPT ); Thu, 18 Apr 2013 17:34:57 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3ILYrtI018415 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 18 Apr 2013 17:34:53 -0400 Received: from dragon.localdomain (ovpn-116-38.ams2.redhat.com [10.36.116.38]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3ILYqNw028024; Thu, 18 Apr 2013 17:34:53 -0400 Received: from [127.0.0.1] (localhost [IPv6:::1]) by dragon.localdomain (Postfix) with ESMTP id 1E4A6E402CA; Thu, 18 Apr 2013 23:37:27 +0200 (CEST) From: Jesper Dangaard Brouer Subject: [net-next PATCH 1/3] net: fix race bug in fragmentation create code To: Eric Dumazet , "David S. Miller" , Hannes Frederic Sowa Cc: Jesper Dangaard Brouer , netdev@vger.kernel.org Date: Thu, 18 Apr 2013 23:37:27 +0200 Message-ID: <20130418213715.14296.43912.stgit@dragon> In-Reply-To: <20130418213637.14296.43143.stgit@dragon> References: <20130418213637.14296.43143.stgit@dragon> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org During creation of a new inet_frag_queue, the lru_list pointer is updated after releasing the hash bucket lock, which can lead to a race condition (and panic), if the inet_frag_queue is deleted (very quickly) before the lru_list is valid. This race condition is should not be able to occur with current LRU based evictor. For the planned direct hash based evictor/clean strategy, this race condition is more likely to occur. Signed-off-by: Jesper Dangaard Brouer --- net/ipv4/inet_fragment.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) -- 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/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c index e97d66a..beec05b 100644 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c @@ -283,9 +283,9 @@ static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf, atomic_inc(&qp->refcnt); hlist_add_head(&qp->list, &hb->chain); + inet_frag_lru_add(nf, qp); spin_unlock(&hb->chain_lock); read_unlock(&f->lock); - inet_frag_lru_add(nf, qp); return qp; }