From patchwork Tue Dec 15 20:01:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Frederic Sowa X-Patchwork-Id: 557068 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 B13861402BF for ; Wed, 16 Dec 2015 07:02:13 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=stressinduktion.org header.i=@stressinduktion.org header.b=jTtGqLZu; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b=m9KqWjFc; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933642AbbLOUCI (ORCPT ); Tue, 15 Dec 2015 15:02:08 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:55082 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932190AbbLOUCG (ORCPT ); Tue, 15 Dec 2015 15:02:06 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 9CDD721F64 for ; Tue, 15 Dec 2015 15:02:05 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Tue, 15 Dec 2015 15:02:05 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= stressinduktion.org; h=cc:date:from:message-id:subject:to :x-sasl-enc:x-sasl-enc; s=mesmtp; bh=cbnJFTWzMIkRtG6ox9azMFYqgN8 =; b=jTtGqLZuOdZqrRU/16eVUVXKz17rLezpnMl6Onyd6fcqillPk9GpDyjon+3 wuXVOIW4GGeWiLs9bdrqHK9SqJ5DisuVJ+BfseLnoMUPnCgIJlPalDRCurRLpBHK lqSuhQqAsiWWcTQ23J379fkAonpawJsO/BYPfMHe7lNLHfPc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-sasl-enc:x-sasl-enc; s=smtpout; bh=cbnJFTWzMIkRtG6ox9azMFYqgN 8=; b=m9KqWjFcm/f0BtmP+oAQdpwRjN36sz3fPIrG1vtHgjBWtV6MP5QhurWFd+ +1Dc8m7YoTifgV9/mRlBvIIhAgHk5AOiJ/UAu6sTJKxKglr6FXDCLexAkGY+eAZ0 E3e5YKdWCkRQNQzaBUdnkBiM79mp0KK6wFl/7JnHDZo8k0iQg= X-Sasl-enc: FAS0HNGOf9S08EsVKIKDRhP4dHdCwvTAT6ygxRG19w+O 1450209725 Received: from z.com (unknown [213.55.184.153]) by mail.messagingengine.com (Postfix) with ESMTPA id BCF85680137; Tue, 15 Dec 2015 15:02:04 -0500 (EST) From: Hannes Frederic Sowa To: netdev@vger.kernel.org Cc: Tom Herbert Subject: [PATCH net 1/2] fou: clean up socket with kfree_rcu Date: Tue, 15 Dec 2015 21:01:53 +0100 Message-Id: <1450209714-26037-1-git-send-email-hannes@stressinduktion.org> X-Mailer: git-send-email 2.5.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org fou->udp_offloads is managed by RCU. As it is actually included inside the fou sockets, we cannot let the memory go out of scope before a grace period. We either can synchronize_rcu or switch over to kfree_rcu to manage the sockets. kfree_rcu seems appropriate as it is used by vxlan and geneve. Fixes: 23461551c00628c ("fou: Support for foo-over-udp RX path") Cc: Tom Herbert Signed-off-by: Hannes Frederic Sowa --- net/ipv4/fou.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c index e0fcbbbcfe54d0..bd903fe0f7508d 100644 --- a/net/ipv4/fou.c +++ b/net/ipv4/fou.c @@ -24,6 +24,7 @@ struct fou { u16 type; struct udp_offload udp_offloads; struct list_head list; + struct rcu_head rcu; }; #define FOU_F_REMCSUM_NOPARTIAL BIT(0) @@ -417,7 +418,7 @@ static void fou_release(struct fou *fou) list_del(&fou->list); udp_tunnel_sock_release(sock); - kfree(fou); + kfree_rcu(fou, rcu); } static int fou_encap_init(struct sock *sk, struct fou *fou, struct fou_cfg *cfg)