lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 18 Dec 2017 09:54:28 +0100
From:   Vitaly Kuznetsov <vkuznets@...hat.com>
To:     Jia-Ju Bai <baijiaju1990@...il.com>
Cc:     kys@...rosoft.com, haiyangz@...rosoft.com, sthemmin@...rosoft.com,
        devel@...uxdriverproject.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] hv: Fix unnecessary sleeping in hv_synic_alloc

Jia-Ju Bai <baijiaju1990@...il.com> writes:

> The kzalloc function is called with GFP_ATOMIC.
> But according to driver call graph, it is not in atomic context,
> namely no spinlock is held nor in an interrupt handler.
>
> This GFP_ATOMIC is unnecessary, and replace with GFP_KERNEL.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
> ---
>  drivers/hv/hv.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
> index 8267439..b0d025a 100644
> --- a/drivers/hv/hv.c
> +++ b/drivers/hv/hv.c
> @@ -150,7 +150,7 @@ int hv_synic_alloc(void)
>  	int cpu;
>
>  	hv_context.hv_numa_map = kzalloc(sizeof(struct cpumask) * nr_node_ids,
> -					 GFP_ATOMIC);
> +					 GFP_KERNEL);
>  	if (hv_context.hv_numa_map == NULL) {
>  		pr_err("Unable to allocate NUMA map\n");
>  		goto err;

Reviewed-by: Vitaly Kuznetsov <vkuznets@...hat.com>

The subject line is not very accurate: GFP_KERNEL you switch too is the
one supporting 'sleep' when there's not enough memory, not
GFP_ATOMIC so you don't actually "Fix unnecessary sleeping". I'd suggest
you use something like "hyper-v: use GFP_KERNEL for hv_context.hv_numa_map"

-- 
  Vitaly

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ