Re: Race condition in kobject_get_path()

From: Greg KH
Date: Wed Mar 30 2022 - 05:23:09 EST


On Wed, Mar 30, 2022 at 02:47:20PM +0530, Mukesh Ojha wrote:
> Hi All,
>
> We are facing one issue where one driver is trying to register its device
> from driver probe
> and from another path  dev_set_name() done from driver probe of the added
> device whose
> length can be more than earlier which could result in redzone overwritten
> issue.

What drivers are doing this so we can see the code? This should be
happening in order and not at the same time.

>
> Can we get your suggestion here ? is this case of a race here ?
>
>
> p1 p2
>
> *kobject_get_path* <https://opengrok.qualcomm.com/source/s?refs=kobject_get_path&project=KERNEL.PLATFORM.1.0>
>
>
>                             =>  get_kobj_path_length  (length is calculated
> from this path)
>                                dev_set_name(same dev name)
>                                  => fill_kobj_path  (path is copied here)

I do not understand this trace, sorry. What code are you referring to?

confused,

greg k-h