[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CY4PR21MB0773FB535B3F4177CA9662C0A04B0@CY4PR21MB0773.namprd21.prod.outlook.com>
Date: Thu, 14 Mar 2019 14:56:59 +0000
From: KY Srinivasan <kys@...rosoft.com>
To: Kangjie Lu <kjlu@....edu>
CC: "pakki001@....edu" <pakki001@....edu>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Sasha Levin <sashal@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
"x86@...nel.org" <x86@...nel.org>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] hyperv: a potential NULL pointer dereference
> -----Original Message-----
> From: Kangjie Lu <kjlu@....edu>
> Sent: Wednesday, March 13, 2019 10:47 PM
> To: kjlu@....edu
> Cc: pakki001@....edu; KY Srinivasan <kys@...rosoft.com>; Haiyang Zhang
> <haiyangz@...rosoft.com>; Stephen Hemminger
> <sthemmin@...rosoft.com>; Sasha Levin <sashal@...nel.org>; Thomas
> Gleixner <tglx@...utronix.de>; Ingo Molnar <mingo@...hat.com>; Borislav
> Petkov <bp@...en8.de>; H. Peter Anvin <hpa@...or.com>; x86@...nel.org;
> linux-hyperv@...r.kernel.org; linux-kernel@...r.kernel.org
> Subject: [PATCH] hyperv: a potential NULL pointer dereference
>
> In case alloc_page, the fix returns -ENOMEM to avoid the potential
> NULL pointer dereference.
>
Thanks.
> Signed-off-by: Kangjie Lu <kjlu@....edu>
Signed-off-by: K. Y. Srinivasan <kys@...rosoft.com>
> ---
> arch/x86/hyperv/hv_init.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
> index 7abb09e2eeb8..dfdb4ce1ae9c 100644
> --- a/arch/x86/hyperv/hv_init.c
> +++ b/arch/x86/hyperv/hv_init.c
> @@ -102,9 +102,13 @@ static int hv_cpu_init(unsigned int cpu)
> u64 msr_vp_index;
> struct hv_vp_assist_page **hvp =
> &hv_vp_assist_page[smp_processor_id()];
> void **input_arg;
> + struct page *pg;
>
> input_arg = (void **)this_cpu_ptr(hyperv_pcpu_input_arg);
> - *input_arg = page_address(alloc_page(GFP_KERNEL));
> + pg = alloc_page(GFP_KERNEL);
> + if (unlikely(!pg))
> + return -ENOMEM;
> + *input_arg = page_address(pg);
>
> hv_get_vp_index(msr_vp_index);
>
> --
> 2.17.1
Powered by blists - more mailing lists