From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexei Starovoitov Subject: Re: [PATCH v2 net-next] fix unsafe set_memory_rw from softirq Date: Thu, 3 Oct 2013 16:10:58 -0700 Message-ID: References: <1380840466-3822-1-git-send-email-ast@plumgrid.com> <1380841333.19002.259.camel@edumazet-glaptop.roam.corp.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 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 To: Eric Dumazet Return-path: In-Reply-To: <1380841333.19002.259.camel@edumazet-glaptop.roam.corp.google.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org On Thu, Oct 3, 2013 at 4:02 PM, Eric Dumazet wrote: > 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() I think it's cleaner too, just didn't want to touch all architectures. Will do then.