All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin Foster <colin.foster@in-advantage.com>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: "Toke Høiland-Jørgensen" <toke@redhat.com>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	"Jesper Dangaard Brouer" <hawk@kernel.org>
Subject: [net RFC v1 1/1] page_pool: fix NULL dereference crash
Date: Fri, 21 Jan 2022 16:56:44 -0800	[thread overview]
Message-ID: <20220122005644.802352-2-colin.foster@in-advantage.com> (raw)
In-Reply-To: <20220122005644.802352-1-colin.foster@in-advantage.com>

Check for the existence of page pool params before dereferencing. This can
cause crashes in certain conditions.

Fixes: 35b2e549894b ("page_pool: Add callback to init pages when they are
allocated")

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
---
 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)
 		pool->p.init_callback(page, pool->p.init_arg);
 }
 
-- 
2.25.1


  reply	other threads:[~2022-01-22  0:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-22  0:56 [net RFC v1 0/1] Fix NULL pointer dereference in page_pool Colin Foster
2022-01-22  0:56 ` Colin Foster [this message]
2022-01-22  1:13   ` [net RFC v1 1/1] page_pool: fix NULL dereference crash Alexei Starovoitov
2022-01-22  2:20     ` Colin Foster
2022-01-22  2:47       ` Alexei Starovoitov
2022-01-24 12:12         ` Toke Høiland-Jørgensen
2022-01-22  2:40     ` Colin Foster
2022-01-22  8:31       ` Jesper Dangaard Brouer
2022-01-22 19:46         ` Colin Foster
2022-01-22  3:15   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220122005644.802352-2-colin.foster@in-advantage.com \
    --to=colin.foster@in-advantage.com \
    --cc=ast@kernel.org \
    --cc=davem@davemloft.net \
    --cc=hawk@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=toke@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.