linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dongyang Zhan <zdyzztq@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Fwd: Possible null pointer dereference caused by vmstat_start()
Date: Thu, 14 May 2020 11:59:42 +0800	[thread overview]
Message-ID: <CAFSR4ctk4PgMcLGTx6Q7K2DzF+efpG2irnBcod1HZTEH7i6tRg@mail.gmail.com> (raw)
In-Reply-To: <CAFSR4csC1u8UVga3JjqN2w2D25NeboKxgWVs5LjAN+Zgyq+_pQ@mail.gmail.com>

发件人: Dongyang Zhan <zdyzztq@gmail.com>
Date: 2020年5月3日周日 下午1:45
Subject: Possible null pointer dereference caused by vmstat_start()
To: <fenghua.yu@intel.com>
Cc: <linux-kernel@vger.kernel.org>


In Linux 4.10.17, vmstat_start() stores the results of v =
kmalloc(stat_items_size, GFP_KERNEL) in m->private = v before security
check. If m->private is accessed, it may cause null pointer
dereference.

Source code link:
https://elixir.bootlin.com/linux/v4.10.17/source/mm/vmstat.c#L1465

Source code;
v = kmalloc(stat_items_size, GFP_KERNEL);
m->private = v; //stores v before check;
if (!v)
 return ERR_PTR(-ENOMEM);

Function rdtgroup_seqfile_show() in
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c access this pointer without
check, which is a possible bug.

Link:
https://elixir.bootlin.com/linux/v4.10.17/source/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c#150
Source Code
static int rdtgroup_seqfile_show(struct seq_file *m, void *arg)
{
struct kernfs_open_file *of = m->private;
struct rftype *rft = of->kn->priv; // without check;

if (rft->seq_show)
return rft->seq_show(of, m, arg);
return 0;
}

           reply	other threads:[~2020-05-14  3:59 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CAFSR4csC1u8UVga3JjqN2w2D25NeboKxgWVs5LjAN+Zgyq+_pQ@mail.gmail.com>]

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=CAFSR4ctk4PgMcLGTx6Q7K2DzF+efpG2irnBcod1HZTEH7i6tRg@mail.gmail.com \
    --to=zdyzztq@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).