From: Ben Greear Subject: Re: [PATCH] net-fq: Add WARN_ON check for null flow. Date: Thu, 7 Jun 2018 15:08:39 -0700 Message-ID: <7f4d0c7c-8617-346d-8073-42680662eab6@candelatech.com> References: <1528387585-5806-1-git-send-email-greearb@candelatech.com> <6dd70f92-f026-0b2a-9aed-91f303ee4335@candelatech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Linux Kernel Network Developers To: Cong Wang Return-path: Received: from mail2.candelatech.com ([208.74.158.173]:51142 "EHLO mail2.candelatech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751739AbeFGWIm (ORCPT ); Thu, 7 Jun 2018 18:08:42 -0400 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On 06/07/2018 02:52 PM, Cong Wang wrote: > On Thu, Jun 7, 2018 at 2:41 PM, Ben Greear wrote: >> On 06/07/2018 02:29 PM, Cong Wang wrote: >>> >>> On Thu, Jun 7, 2018 at 9:06 AM, wrote: >>>> >>>> --- a/include/net/fq_impl.h >>>> +++ b/include/net/fq_impl.h >>>> @@ -80,6 +80,9 @@ static struct sk_buff *fq_tin_dequeue(struct fq *fq, >>>> >>>> flow = list_first_entry(head, struct fq_flow, flowchain); >>>> >>>> + if (WARN_ON_ONCE(!flow)) >>>> + return NULL; >>>> + >>> >>> >>> How could even possibly list_first_entry() returns NULL? >>> You need list_first_entry_or_null(). >>> >> >> I don't know for certain flow as null, but something was NULL in this method >> near that line and it looked like a likely culprit. >> >> I guess possibly tin or fq was passed in as NULL? > > A NULL pointer is not always 0. You can trigger a NULL-ptr-def with 0x3c > too, but you are checking against 0 in your patch, that is the problem and > that is why list_first_entry_or_null() exists. > Ahh, I see what you mean, and that is my mistake. In my case, it did seem to be a mostly-null deref, not a 0x0 deref. Thanks, Ben -- Ben Greear Candela Technologies Inc http://www.candelatech.com