Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753531Ab3JCXCS (ORCPT ); Thu, 3 Oct 2013 19:02:18 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:54401 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753122Ab3JCXCR (ORCPT ); Thu, 3 Oct 2013 19:02:17 -0400 Message-ID: <1380841333.19002.259.camel@edumazet-glaptop.roam.corp.google.com> Subject: Re: [PATCH v2 net-next] fix unsafe set_memory_rw from softirq From: Eric Dumazet To: Alexei Starovoitov Cc: "David S. Miller" , netdev@vger.kernel.org, Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Daniel Borkmann , "Paul E. McKenney" , Xi Wang , x86@kernel.org, Eric Dumazet , Heiko Carstens , linux-kernel@vger.kernel.org Date: Thu, 03 Oct 2013 16:02:13 -0700 In-Reply-To: <1380840466-3822-1-git-send-email-ast@plumgrid.com> References: <1380840466-3822-1-git-send-email-ast@plumgrid.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 862 Lines: 31 On Thu, 2013-10-03 at 15:47 -0700, Alexei Starovoitov wrote: > on x86 system with net.core.bpf_jit_enable = 1 > > --- a/net/core/filter.c > +++ b/net/core/filter.c > @@ -644,7 +644,9 @@ void sk_filter_release_rcu(struct rcu_head *rcu) > struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); > > bpf_jit_free(fp); > +#if !defined(CONFIG_X86_64) /* x86_64 has a deferred free */ > kfree(fp); > +#endif Sorry this is not very nice. Make bpf_jit_free(fp) a bool ? true : caller must free, false : caller must not free ? if (bpf_jit_free(fp)) kfree(fp); Or move the kfree() in bpf_jit_free() -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/