incorrect parent refcounting in subr_firmware.c?

Navdeep Parhar nparhar at gmail.com
Wed Nov 2 20:22:14 UTC 2011


I built a KLD with multiple firmware images, as shown here:

KMOD=foo
FIRMWS= foo.bin:foo:1.0.0.0
FIRMWS+=bar.bin:bar:1.0.0.0
FIRMWS+= ...
.include <bsd.kmod.mk>

"foo" is the parent firmware and a firmware_get(foo) can autoload the
KLD.  "bar" and the rest are available only if the KLD is loaded (by
whatever means).  This is reasonable and works as expected.  But if I
just get and then put "foo" back, the KLD is not unloaded automatically.

The problem is that a reference is placed on the parent firmware when
the other firmwares are registered (during module load).  I think this
reference should be placed during firmware_get on the child.

What do people think about the attached patch?  It fixes things for me.

Regards,
Navdeep
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fw.diff
Type: application/octet-stream
Size: 1176 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20111102/dc2d169d/fw.obj


More information about the freebsd-hackers mailing list