Skip to contentSkip to conversation

Memory leak in cpufreq-nforce2.c

DISCUSSION GW 2 participants 2 messages Aug 23, 2007 – Aug 24, 2007

lore
Share & tools
lore

GW

author
#0 lore raw

Hello.

I accidentally found something missing in cpufreq-nforce2.c and asked on linux-pci mailing list about it:

Quoted 7 lines · Greg KH
Quoted 2 lines · GW

I was wondering if after every usage of pci_get_subsys() when you don't need the device anymore you need to call pci_dev_put(dev)?

Yes, that is a requirement.

I don't understand why you would think it would not be necessary.

This means that there are some memory leaks in the following driver that uses pci_get_subsys(), but no pci_dev_put():

arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c
in function nforce2_fsb_read()
in function __exit nforce2_exit(), because in __init nforce2_init() it calls nforce2_detect_chipset() that doesn't release the device

I don't have this chip, therefore I couldn't test a patch if I would written it.

gw

#1 lore raw

Hello,

Quoted 3 lines · GW

This means that there are some memory leaks in the following driver that uses pci_get_subsys(), but no pci_dev_put():

Yes, pci_dev_put(nforce2_chipset_dev) is missing in nforce2_exit()...

Quoted 1 line

I don't have this chip, therefore I couldn't test a patch if I would written it.

...unfortunately I don't own the original hardware with nForce2 chipset anymore.
I don't think a patch for correcting this bug modifies the expected
behaviour...but it should be tested by someone who ones compatible hardware.

Regards,
Sebastian