On Wed, 13 Apr 2022 11:11:07 -0700, Ashutosh Dixit wrote:
>
> All kmalloc'd kobjects need a kobject_put() to free memory. For example in
> previous code, kobj_gt_release() never gets called.

Even if kobj_gt_release() were to get called, the code allocates 'struct
kobj_gt' and frees 'struct kobject'. Similar memory leaks are also present
in sysfs_engines.c from where this code pattern is borrowed.

Since these memory leaks occur only at module unload (or device removal)
they are not serious but it may still be worth it to fix them and also not
further propagate an erroneous code pattern. Thanks.

Reply via email to