Page MenuHomeFreeBSD

qlnxr: Properly initialize the Linux device structure
ClosedPublic

Authored by markj on Apr 5 2021, 8:17 PM.
Tags
None
Referenced Files
F132149688: D29595.diff
Tue, Oct 14, 5:19 AM
Unknown Object (File)
Thu, Oct 9, 1:42 AM
Unknown Object (File)
Sun, Sep 21, 1:52 AM
Unknown Object (File)
Fri, Sep 19, 11:20 AM
Unknown Object (File)
Mon, Sep 15, 5:22 PM
Unknown Object (File)
Aug 21 2025, 3:38 AM
Unknown Object (File)
Aug 15 2025, 12:17 AM
Unknown Object (File)
Aug 2 2025, 6:13 AM
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