Re: [PATCH] nvmem: core: Fix a potential use after free
From: Markus Elfring
Date: Sat Dec 28 2019 - 06:31:11 EST
> Free the nvmem structure only after we are done using it.
This information can be reasonable.
> This patch just moves the put_device() down a bit to avoid the
> use after free.
I suggest to reconsider such a change because a device reference count
should eventually be decremented before decrementing the reference count
for the module which is managed by this programming interface.
Are you also looking for better software documentation for such an use case?
Regards,
Markus