Page MenuHomeFreeBSD

LinuxKPI: fix lkpi_pci_get_device() reference counting on device
ClosedPublic

Authored by bz on Jun 4 2026, 8:41 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Aug 24, 3:41 PM
Unknown Object (File)
Mon, Aug 24, 9:03 AM
Unknown Object (File)
Sat, Aug 22, 9:49 AM
Unknown Object (File)
Fri, Aug 21, 10:12 PM
Unknown Object (File)
Thu, Aug 20, 3:24 PM
Unknown Object (File)
Wed, Aug 19, 7:02 PM
Unknown Object (File)
Sat, Aug 15, 10:05 AM
Unknown Object (File)
Sat, Aug 15, 10:05 AM
Subscribers

Details

Summary

In case we are passed an "odev" (a device to start the search from),
that device would have an extra reference. The best way to illustrate
this is to look at for_each_pci_dev() which will return one device
after the other. Upon first return we return a pdev with a reference.
That pdev is then passed in as odev on the next call. If we do not
clear the reference it will be leaked.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Fixes: 910cf345d0ee9 ("LinuxKPI: pci: implement ...")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bz requested review of this revision.Jun 4 2026, 8:41 AM

Anyone? Otherwise I'll commit this the next days.

Are there actually any callers with non-NULL odev? (I.e., is this not an issue in practice today)

Oh, via for_each_pci_dev of course

This revision is now accepted and ready to land.Jul 9 2026, 9:37 PM