Re: [PATCH v4 1/2] devcoredump: remove the useless gfp_t parameter in dev_coredumpv
From: duoming
Date: Thu Jun 02 2022 - 20:42:41 EST
Hello,
On Thu, 2 Jun 2022 13:32:48 -0700 Jeff Johnson wrote:
> 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?
Thanks for your suggestion, I will remove the gfp_t parameter of dev_coredumpm() as well.
Best regards,
Duoming Zhou