openhpi2 / Open-HPI

Open HPI is an open source implementation of the SA Forum's Hardware Platform Interface (HPI). HPI provides an abstracted interface to managing computer hardware, typically for chassis and rack based servers
Other
3 stars 1 forks source link

Fix double free in sysfs #2608

Closed openhpi2 closed 8 years ago

openhpi2 commented 8 years ago

If you enable libsysfs2hpi plugin in the conf file, run openhpid and stop it with no i2c devices, the following happens:

sysfs: CRIT: sysfs2hpi.c:572: no i2c devices found
[...]

*** Error in `/tmp/sbin/openhpid': double free or corruption (out):
0x00007ffff0024440 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x77e35)[0x7ffff624ae35]
/lib64/libc.so.6(+0x8051a)[0x7ffff625351a]
/lib64/libc.so.6(cfree+0x4c)[0x7ffff6256ccc]
/tmp/lib/openhpi/libsysfs2hpi.so(oh_close+0x19)[0x7ffff5b76ad9]
/tmp/sbin/openhpid(oh_close_handlers+0x45)[0x4134b5]
/tmp/sbin/openhpid(oh_finit+0xe)[0x41281e]
/tmp/sbin/openhpid(main+0x3ea)[0x407aaa]
/lib64/libc.so.6(__libc_start_main+0xf0)[0x7ffff61f3580]
/tmp/sbin/openhpid(_start+0x29)[0x407c19]

the attached patch fix the issue.

Attachments: sysfs-double-free.patch.txt

Reported by: rdossant

openhpi2 commented 8 years ago

Any comments on this?

Original comment by: rdossant

openhpi2 commented 8 years ago

Patch looks good for me.

Original comment by: hemanthreddy

openhpi2 commented 8 years ago

Original comment by: dr_mohan

openhpi2 commented 8 years ago

Fixed with checkin #7666

Original comment by: dr_mohan