Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2505765pxb; Sun, 23 Jan 2022 06:53:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzI9uu0IHX66FYwzFIu2/St2/QaEbeNNTmgzLnVgKCEbVyDcDTTjeGDgRJaHBatMzoktl4Y X-Received: by 2002:a17:902:db0a:b0:14b:4b3c:e08a with SMTP id m10-20020a170902db0a00b0014b4b3ce08amr1951793plx.125.1642949615490; Sun, 23 Jan 2022 06:53:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642949615; cv=none; d=google.com; s=arc-20160816; b=UrZvB+VwK2nhmzlo54ClUoCI/1iSJJd8xazEx7Fie9ZTPXkIurEySaLJ+UMb8b7gnJ OGPbInQcFjAuZIuNQp96MStAJkK1wCtxFvL1+xWQb8pjj2EpmGNmm4letbr8Nxi9ahmM ZPiKU0Zio1IpcrTahKEcVOa52Ikcf91hswb4cZHyBK58/HXvZOT0URO+H0BuL65Ye2Zr dq1VjoPYHZm248dcve4hDG1Sf5JYTeOY/Jo2GONO4pigBNgan9SrLbpiBsIkvyFn/8Nx xfarNHdkh1jDRst/dAQwBYDSmxnLva7OXWEzBU72woXHBw5lzMbn58pc33517xlQZHMH 4AsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :to:content-language:subject:cc:user-agent:mime-version:date :message-id:from:dkim-signature; bh=jCimr63v8CEPF1zIfZIJt01XQ0IyOhIWO0SMYz9s+Rg=; b=n85ykPuQRv3HS3LG5ufT4g3vkG1p2p6u/1HEuq6WGbuJ+LHPXcYioCdaWSoGzEvuvG ZQAxWAt0eNNab/i0HY2QTS4r8ABgmW0pqFJ0lFgwqKCQRuxKAOaHOdcHcJBoNBmptx40 Q9GCqIwcKoGFPfNdQvTQAdTm2J29wBOyb0YPMt2WU/xeQY0jt+xKt0G6urGaDKM3Xa+4 pEofy4os4PTFuXlNPpsHmzmdMtntIRI33bw40+1jRNYPVUoPv/kct3HmUQKydmI4vlW0 sRT8cd1bb1ZKXfxJqaQNOKDCMDXEqVbZxxPTYYLojbImiOQIUPnSbFg0oH+W58r7BET6 suRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HqkRc3fE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pc10si12806404pjb.38.2022.01.23.06.53.24; Sun, 23 Jan 2022 06:53:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HqkRc3fE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233052AbiAVIb2 (ORCPT + 99 others); Sat, 22 Jan 2022 03:31:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:35780 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231954AbiAVIb0 (ORCPT ); Sat, 22 Jan 2022 03:31:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642840286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jCimr63v8CEPF1zIfZIJt01XQ0IyOhIWO0SMYz9s+Rg=; b=HqkRc3fEFXT5TQSfjK4pS+IhO7KqvS2VP4AmLTeB95lPLOvzt/s3f3F71YrlE6wKA0ce4/ yOuiPc7q18/HFtwwVi8BNZpLpWcyOhSezdkd3Th/0gSQ4kfonrQPssR76oytHYBMBglR2r ID+fiYGfNDRHiUAkrMx3O9eIKYqG0bw= Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-116-m6RGnWR6NLa0gxfTkTnckA-1; Sat, 22 Jan 2022 03:31:21 -0500 X-MC-Unique: m6RGnWR6NLa0gxfTkTnckA-1 Received: by mail-lj1-f200.google.com with SMTP id f6-20020a05651c160600b00235b3d76947so426711ljq.15 for ; Sat, 22 Jan 2022 00:31:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:date:mime-version:user-agent:cc :subject:content-language:to:references:in-reply-to :content-transfer-encoding; bh=jCimr63v8CEPF1zIfZIJt01XQ0IyOhIWO0SMYz9s+Rg=; b=STRqWtqynX/sxuSXDrayqSnAkLgdmVlLyVKr8YxHtX48wlAbcazGF/ZmjSgDYAVvob 6I/v761hCrIu5mCFz6opnPpM728uBGqU7yas9w5pXP+zDPvZdtm8Ub8kc9LWndkDeaFL YvQgaZqMCMeEiKsqLig3Xq/q8lOQt0daPKseShDMqlqXzMDeR/ZR+0drrTavM3DbfYpk D3rXlrq4jY3C0ShLJqKDFgHcFrCxH9ma8rJR5ACjb4MM/4/a61g/GetbXXMfaLapFzFa JhBKeKPg9c+AHcK4ylTkgZPxOhSxdjSxXcyu0vVWa2RW0ZZR6Y61F2MObHKv2z1Gdm2T IpIg== X-Gm-Message-State: AOAM530FDjYimfInbHSz2iQjgkzeumHhlTPXVLgRD6d6yEHGuRNzh5T3 oZSyRQeLsT+b1tA2Z+/ltjhQbUikh6TwktsdSqjREG2qiUNWFKh/josNEhlmyZSGfyW/VaV2pMd eAUeK8aX4MU2ezapRI3g2/jAP X-Received: by 2002:a05:6512:3f9f:: with SMTP id x31mr6454749lfa.391.1642840279845; Sat, 22 Jan 2022 00:31:19 -0800 (PST) X-Received: by 2002:a05:6512:3f9f:: with SMTP id x31mr6454741lfa.391.1642840279670; Sat, 22 Jan 2022 00:31:19 -0800 (PST) Received: from [192.168.0.50] (87-59-106-155-cable.dk.customer.tdc.net. [87.59.106.155]) by smtp.gmail.com with ESMTPSA id n21sm497430lfe.153.2022.01.22.00.31.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 22 Jan 2022 00:31:18 -0800 (PST) From: Jesper Dangaard Brouer X-Google-Original-From: Jesper Dangaard Brouer Message-ID: <5bd8f1bd-1a21-df1b-6d6f-9fe5657fdd7c@redhat.com> Date: Sat, 22 Jan 2022 09:31:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Cc: brouer@redhat.com, LKML , Network Development , =?UTF-8?Q?Toke_H=c3=b8iland-J=c3=b8rgensen?= , John Fastabend , Alexei Starovoitov , Jakub Kicinski , "David S. Miller" , Ilias Apalodimas , Jesper Dangaard Brouer Subject: Re: [net RFC v1 1/1] page_pool: fix NULL dereference crash Content-Language: en-US To: Colin Foster , Alexei Starovoitov References: <20220122005644.802352-1-colin.foster@in-advantage.com> <20220122005644.802352-2-colin.foster@in-advantage.com> <20220122024051.GA905413@euler> In-Reply-To: <20220122024051.GA905413@euler> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/01/2022 03.40, Colin Foster wrote: > On Fri, Jan 21, 2022 at 05:13:28PM -0800, Alexei Starovoitov wrote: >> On Fri, Jan 21, 2022 at 4:57 PM Colin Foster >> wrote: >>> >>> Check for the existence of page pool params before dereferencing. This can >>> cause crashes in certain conditions. >> >> In what conditions? >> Out of tree driver? >> >>> Fixes: 35b2e549894b ("page_pool: Add callback to init pages when they are >>> allocated") >>> >>> Signed-off-by: Colin Foster >>> --- >>> net/core/page_pool.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/net/core/page_pool.c b/net/core/page_pool.c >>> index bd62c01a2ec3..641f849c95e7 100644 >>> --- a/net/core/page_pool.c >>> +++ b/net/core/page_pool.c >>> @@ -213,7 +213,7 @@ static void page_pool_set_pp_info(struct page_pool *pool, >>> { >>> page->pp = pool; >>> page->pp_magic |= PP_SIGNATURE; >>> - if (pool->p.init_callback) >>> + if (pool->p && pool->p.init_callback) > > And my apologies - this should be if (pool... not if (pool->p. kernelbot > will be sure to tell me of this blunder soon Can you confirm if your crash is fixed by this change? >>> pool->p.init_callback(page, pool->p.init_arg); >>> }