Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3778953ybi; Mon, 29 Jul 2019 12:27:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhUjHVAtQnhGMDClvvGIH1EiJwyLseC+L168FssSBhIwZJlXYsJSspqzdkPSlxU3YOsbAi X-Received: by 2002:aa7:8502:: with SMTP id v2mr37254334pfn.98.1564428472631; Mon, 29 Jul 2019 12:27:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428472; cv=none; d=google.com; s=arc-20160816; b=G/Ij6hvBLSOgu3o7sEdQVozF2x79tiTOmyW/C8Y0AeG18l+YYT1s3P6T8Ht6imdjK/ qJicWPgSRuA2iN6wig1F+LCRFITBNBxPJLJ8mPFazwSM6K1rv2eyz78GZV6si3ymzoMO /nMCrKUIwsiDR6Gs06POAe9N9U53IQVajkXEk6WDCm0eJ2BQvGI/oSPXfhl/36I6htFZ NUXfW1KxihtFwFBhcEj7JDgAkgGoz0frqlHKG/aHb6VdyjruTFMufonUdOwzHnI6dq9U oyTDlzDcxxkkamYz/pg1H22v+oHK2I5gL9yjKXI6/fPW/NI96z5l53xwUEgoUmhKtcRG l1Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Ts6M6hSea67FuVk3C4sXGDdL2yaHVXXA+9CMQ2KSBP0=; b=UQCTDjTGUJh8AKyy/XiYV3BF2o8eugo8gYNx7hPCZ7AjIq53ZKJi8fnVrRjHvuI124 GlTC0Lqk/FfUiSWwMM4WM30RPBXfdZeG0SqLV4xzcjO3FNCEL2K3+6654KtANZxmP7r0 /G59HhfXoaXBG1jCh4Ul5SL8MARdECaLTsr6dMDU9yhxAgbtiYhEoFQaKNi0c2DwcPoT FblcdMoPAffqf7giWdnzH02j+r9Q6cX5jlkCRSbHc8fIM7au/Wdl9zX4VTObtqrCodeu NmSPLY0tLORQxIqKELCyIFuHgQ2eFe0EYreZ20WBM8Csd4sbsapnw92CZpv61jJRcI6f 1kgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EuBo9h2t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 141si27045014pgh.166.2019.07.29.12.27.37; Mon, 29 Jul 2019 12:27:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EuBo9h2t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728732AbfG2RYF (ORCPT + 99 others); Mon, 29 Jul 2019 13:24:05 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:37020 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725934AbfG2RYF (ORCPT ); Mon, 29 Jul 2019 13:24:05 -0400 Received: by mail-pg1-f196.google.com with SMTP id i70so17851172pgd.4; Mon, 29 Jul 2019 10:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ts6M6hSea67FuVk3C4sXGDdL2yaHVXXA+9CMQ2KSBP0=; b=EuBo9h2tpzF5xBLUsLuqGuwzPfIrOWbdNvrR9PKZ9GeAkLVHJwX1iF3WpvI4boMbpx kmu0YFzVwp2eCyd4bJUNdtHwvqPm01waXWicSV/l3lgVEOcJ3uz9HKoDVv0BgOOkhiMK udILty0X4PJSuy1AEtNJJJGIDP72OvvIa/4kPjyk3pgNleGFClSdDDTvnW8IlbyAjrLu 5gTUdsu3kjVmezpOiqW9y5IvWNpdpzcFXAre7nXY+HZTf6KAzmLQozlIyRBZWKRxAhdm 5NgCGjDacSUOQvQBQRBavwVCYe1bMr2Q/tLECvWkK96adzkTcEW596wAS9OQIc63sdM3 dzBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ts6M6hSea67FuVk3C4sXGDdL2yaHVXXA+9CMQ2KSBP0=; b=GdkHnsFABZ57CTGQBYMp/Y5d0TVNwtYvE8kPT+JT35Cph2Z4ZaMR/tNTDZ+P/YPNi9 lyxjESsiHUSfXbNCekvwGGtT7ln6MAWVr9yS46tpgsvRLy1U7oIDCEBX55QEeJr9ZF21 ogJCz5gw3t89kgAgnZatB4QVkW/WUjh4WKzjBxgqb5yVH+AfJ6VJq73zKxejDFHlBbmH n/IFcvXzIA7CizuNugQkRVaqgFUtuOUHs8NEOH0pnmemXXUaS11JvsR1mqrQ3Vm7OuD0 RB2ZrMChD4w1NMxTCNFNlNG/ye4WFAqcl5VZbXtkxTHYlaY5rhu7CcaU4ZTBEy0oGVXn bNVQ== X-Gm-Message-State: APjAAAWV40728U/2mcsrbv6gFKFu6TzHa544Vkfz2tOqAlozuO7FWIUj moLPHM+de8mr568NtFx/qSZwEqFUspXTfGiXBG084kX2 X-Received: by 2002:a63:36cc:: with SMTP id d195mr64093477pga.157.1564421044400; Mon, 29 Jul 2019 10:24:04 -0700 (PDT) MIME-Version: 1.0 References: <20190729082433.28981-1-baijiaju1990@gmail.com> In-Reply-To: <20190729082433.28981-1-baijiaju1990@gmail.com> From: Cong Wang Date: Mon, 29 Jul 2019 10:23:53 -0700 Message-ID: Subject: Re: [PATCH v3] net: sched: Fix a possible null-pointer dereference in dequeue_func() To: Jia-Ju Bai Cc: Jamal Hadi Salim , Jiri Pirko , David Miller , Linux Kernel Network Developers , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 29, 2019 at 1:24 AM Jia-Ju Bai wrote: > > In dequeue_func(), there is an if statement on line 74 to check whether > skb is NULL: > if (skb) > > When skb is NULL, it is used on line 77: > prefetch(&skb->end); > > Thus, a possible null-pointer dereference may occur. > > To fix this bug, skb->end is used when skb is not NULL. > > This bug is found by a static analysis tool STCheck written by us. It doesn't dereference the pointer, it simply calculates the address and passes it to gcc builtin prefetch. Both are fine when it is NULL, as prefetching a NULL address should be okay for kernel. So your changelog is misleading and it doesn't fix any bug, although it does very slightly make the code better.