On 3/30/26 14:09, Dingisoul wrote:
> If __mmu_notifier_register() fails, the function frees encl_mm but
> does not drop the reference acquired by kref_get(&encl->refcount).
> This seems to leak one reference to encl.

Yep it looks like a leak.

> Please let us know if the kref_put is unnecessary here.

The easiest way to fix it is to just move the kref_get() until after the
notifier has been registered. There's no risk of encl going away in this
context, so it doesn't matter when the kref_get() happens as long as it
_does_ happen.

Reply via email to