Re: [PATCH v4 1/2] devcoredump: remove the useless gfp_t parameter in dev_coredumpv

From: Jeff Johnson
Date: Thu Jun 02 2022 - 16:33:16 EST


On 6/2/2022 6:33 AM, Duoming Zhou wrote:
The dev_coredumpv() could not be used in atomic context, because
it calls kvasprintf_const() and kstrdup() with GFP_KERNEL parameter.
The process is shown below:

dev_coredumpv(..., gfp_t gfp)
dev_coredumpm
dev_set_name
kobject_set_name_vargs
kvasprintf_const(GFP_KERNEL, ...); //may sleep
kstrdup(s, GFP_KERNEL); //may sleep

This patch removes gfp_t parameter of dev_coredumpv() and changes the
gfp_t parameter of dev_coredumpm() to GFP_KERNEL in order to show
dev_coredumpv() could not be used in atomic context.

shouldn't you remove the gfp parameter to dev_coredumpm() as well since it is actually within that function where dev_set_name() is called which cannot be done in atomic context?