[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024070940-customize-sturdily-fc81@gregkh>
Date: Tue, 9 Jul 2024 15:32:50 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Ma Ke <make24@...as.ac.cn>
Cc: fbarrat@...ux.ibm.com, ajd@...ux.ibm.com, arnd@...db.de,
manoj@...ux.vnet.ibm.com, mpe@...erman.id.au,
clombard@...ux.vnet.ibm.com, imunsie@....ibm.com,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH] cxl: Fix possible null pointer dereference in
read_handle()
On Tue, Jul 09, 2024 at 09:17:54PM +0800, Ma Ke wrote:
> In read_handle() of_get_address() may return NULL which is later
> dereferenced. Fix this bug by adding NULL check.
>
> Cc: stable@...r.kernel.org
> Fixes: 14baf4d9c739 ("cxl: Add guest-specific code")
> Signed-off-by: Ma Ke <make24@...as.ac.cn>
> ---
> drivers/misc/cxl/of.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/cxl/of.c b/drivers/misc/cxl/of.c
> index bcc005dff1c0..d8dbb3723951 100644
> --- a/drivers/misc/cxl/of.c
> +++ b/drivers/misc/cxl/of.c
> @@ -58,7 +58,7 @@ static int read_handle(struct device_node *np, u64 *handle)
>
> /* Get address and size of the node */
> prop = of_get_address(np, 0, &size, NULL);
> - if (size)
> + if (!prop || size)
> return -EINVAL;
How was this issue found?
thanks,
greg k-h
Powered by blists - more mailing lists