Skip to contentSkip to conversation

PCI: Fix reference count leak in pci_create_slot()

PATCH Markus Elfring 1 participant 1 message May 29, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Please add a prefix to the patch subject.

Quoted 1 line

kobject_init_and_add() takes reference even when it fails.

I suggest to extend this description another bit.
Which object is affected here?

Quoted 2 lines

If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object.

Such a copy from the function description of this programming interface can be helpful.

Quoted 1 line

Thus, when call of kobject_init_and_add() fail,

I propose to avoid the repetition of this condition.

Quoted 1 line

we should call kobject_put() instead of kfree().

How do you think about a wording variant like the following?

Replace a call of the function “kfree” by “kobject_put” because of using kernel objects in the proper way.

Quoted 1 line

Previous commit "b8eb718348b8" fixed a similar problem.

I wonder if such information is really relevant for the commit message.

Regards,
Markus