mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Duoming Zhou <duoming@zju.edu.cn>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, gregory.clement@bootlin.com,
	sebastian.hesselbarth@gmail.com, linux@armlinux.org.uk
Subject: Re: [PATCH] ARM: mvebu: Add check in coherency.c to prevent null pointer dereference
Date: Mon, 26 Feb 2024 14:39:37 +0100	[thread overview]
Message-ID: <eb036663-2109-4d75-8386-451fa5c34889@lunn.ch> (raw)
In-Reply-To: <20240225060450.53044-1-duoming@zju.edu.cn>

On Sun, Feb 25, 2024 at 02:04:50PM +0800, Duoming Zhou wrote:
> The kzalloc() in armada_375_380_coherency_init() will return
> null if the physical memory has run out. As a result, if we
> dereference the property pointer, the null pointer dereference
> bug will happen.
> 
> This patch adds a check to avoid null pointer dereference.
> 
> Fixes: 497a92308af8 ("ARM: mvebu: implement L2/PCIe deadlock workaround")
> Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>

I have to wounder how we can run out of memory here. This code is
being called from:

postcore_initcall(coherency_late_init);

If you look at:

https://elixir.bootlin.com/linux/latest/source/include/linux/init.h#L299

You can see that only true kernel core stuff has been called before
that. If that has consumed all the available memory, something is very
seriously wrong, and the machine is not going to last another couple
of milliseconds before it crashes no matter what checking you do.

So i do wounder if your time could be better spent in other places?

	Andrew

  parent reply	other threads:[~2024-02-26 13:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-25  6:04 Duoming Zhou
2024-02-25 11:30 ` Russell King (Oracle)
2024-02-25 13:20   ` duoming
2024-02-26 13:39 ` Andrew Lunn [this message]
2024-02-26 14:08   ` Russell King (Oracle)

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=eb036663-2109-4d75-8386-451fa5c34889@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=duoming@zju.edu.cn \
    --cc=gregory.clement@bootlin.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=sebastian.hesselbarth@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®