From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Conole Subject: Re: [PATCH nf-next v2 1/2] netfilter: Fix potential null pointer dereference Date: Wed, 28 Sep 2016 09:30:36 -0400 Message-ID: References: <1474983515-4115-1-git-send-email-aconole@bytheb.org> <1474983515-4115-2-git-send-email-aconole@bytheb.org> Mime-Version: 1.0 Content-Type: text/plain Cc: Feng Gao , Netfilter Developer Mailing List , Linux Kernel Network Developers , Florian Westphal , Pablo Neira Ayuso To: Liping Zhang Return-path: Received: from mail-yw0-f193.google.com ([209.85.161.193]:34049 "EHLO mail-yw0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932484AbcI1Naj (ORCPT ); Wed, 28 Sep 2016 09:30:39 -0400 Received: by mail-yw0-f193.google.com with SMTP id t67so1756422ywg.1 for ; Wed, 28 Sep 2016 06:30:39 -0700 (PDT) In-Reply-To: (Liping Zhang's message of "Wed, 28 Sep 2016 11:13:07 +0800") Sender: netfilter-devel-owner@vger.kernel.org List-ID: Liping Zhang writes: > 2016-09-28 11:08 GMT+08:00 Liping Zhang : >> Hi Feng, >> >> 2016-09-28 9:23 GMT+08:00 Feng Gao : >>> Hi Aaraon, >>> >>> On Tue, Sep 27, 2016 at 9:38 PM, Aaron Conole wrote: >>>> It's possible for nf_hook_entry_head to return NULL if two >>>> nf_unregister_net_hook calls happen simultaneously with a single hook >>> >>> The critical region of nf_unregister_net_hook is protected by &nf_hook_mutex. >>> When it would be called simultaneously? >> >> This is unrelated to race condition. >> >> Suppose that only the last nf_hook_entry exist, and two callers want to do >> un-register work. >> >> The first one will remove it successfully, after the end of the work, the >> second one will enter the critical section, but it will see the NULL pointer. >> Because the last nf_hook_entry was already removed by the first one. >> >>> >>> Regards >>> Feng >>> >>>> entry in the list. This fix ensures that no null pointer dereference >>>> could occur when such a race happens. >>>> >>>> Signed-off-by: Aaron Conole > > I read the commit log again, I think the description here is a > little confusing indeed. Sorry about that. I've posted a new description which describes the situation better. I hope it helps. -Aaron