Re: [PATCH] xen: Fix two possible sleep-in-atomic-context bugs in create_active()
From: Juergen Gross
Date: Wed Jun 20 2018 - 05:03:49 EST
On 20/06/18 04:38, Jia-Ju Bai wrote:
> The driver may sleep with holding a spinlock.
> The function call paths (from bottom to top) in Linux-4.16.7 are:
>
> [FUNC] __get_free_pages(GFP_KERNEL)
> drivers/xen/pvcalls-front.c, 351: __get_free_pages in create_active
> drivers/xen/pvcalls-front.c, 800: create_active in pvcalls_front_accept
> drivers/xen/pvcalls-front.c, 783: spin_lock in pvcalls_front_accept
>
> [FUNC] __get_free_pages(GFP_KERNEL)
> drivers/xen/pvcalls-front.c, 347: __get_free_pages in create_active
> drivers/xen/pvcalls-front.c, 800: create_active in pvcalls_front_accept
> drivers/xen/pvcalls-front.c, 783: spin_lock in pvcalls_front_accept
>
> To fix these bugs, GFP_KERNEL is replaced with GFP_ATOMIC.
>
> These bugs are found by my static analysis tool (DSAC-2) and checked by my
> code review.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@xxxxxxxxx>
Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
Juergen