[Intel-gfx] [PATCH 6/8] drm/i915/gt: Fix memory leaks in per-gt sysfs

Dixit, Ashutosh ashutosh.dixit at intel.com
Wed Apr 13 19:14:15 UTC 2022


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.


More information about the Intel-gfx mailing list