Page MenuHomeFreeBSD

qlnxr: Properly initialize the Linux device structure
ClosedPublic

Authored by markj on Apr 5 2021, 8:17 PM.
Tags
None
Referenced Files
F150498355: D29595.id87306.diff
Wed, Apr 1, 5:56 PM
Unknown Object (File)
Sat, Mar 28, 9:28 AM
Unknown Object (File)
Wed, Mar 18, 6:58 AM
Unknown Object (File)
Feb 24 2026, 8:09 AM
Unknown Object (File)
Feb 12 2026, 4:04 AM
Unknown Object (File)
Feb 12 2026, 3:52 AM
Unknown Object (File)
Feb 11 2026, 11:07 AM
Unknown Object (File)
Feb 9 2026, 7:56 PM
Subscribers

Details

Summary

types.h defines device_t to be a struct device *, but the definition of
struct device is internal to subr_bus. But, the LinuxKPI also defines a
struct device, so type confusion is possible.

In this case, we were copying a FreeBSD device structure into a Linux
device structure. The Linux device structure is only used for the IB
device, for allocating DMA'able memory. I believe the old version
worked more or less by accident.

Use linux_pci_attach_device() instead, following the example of the
Chelso iwarp driver. Also ensure that we don't leak the faked device
during detach.

Test Plan

None, I do not have any way to test this.

Diff Detail

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