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)
Wed, Jul 15, 7:25 AM
Unknown Object (File)
Wed, Jul 15, 7:25 AM
Unknown Object (File)
Thu, Jul 2, 4:27 PM
Unknown Object (File)
Jun 22 2026, 7:16 AM
Unknown Object (File)
Jun 16 2026, 3:07 AM
Unknown Object (File)
Jun 15 2026, 12:48 PM
Unknown Object (File)
Jun 15 2026, 12:44 PM
Unknown Object (File)
Jun 11 2026, 1:59 PM
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.Thu, Jul 9, 9:37 PM