Opened 5 years ago

Last modified 5 years ago

#15095 assigned bug

if_free not called on (some?) attach failures

Reported by: bga Owned by: bga
Priority: normal Milestone: Unscheduled
Component: Drivers/Network Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

If during attach() a device for some reason fails to initialize, there are cases where gDeviceCount will not be decremented (specially when using iflib) as the place where this happens currently is never called in that case. So even if the device is not successfully initialized, the driver is not unloaded and the /dev entry still hangs around.

We probably want to move the handling to a higher abstraction or simply remove it (it is not obvious to me if it is used outside the compatibility layer).

Change History (1)

comment:1 by waddlesplash, 5 years ago

Component: Network & InternetDrivers/Network
Summary: gDeviceCount management in the FreeBSD compatibility layer needs improvement.if_free not called on (some?) attach failures

The problem appears to be that if_free is not called on attach failures. iflib calls that when deregistering the device. Perhaps when attach fails, we should call if_free ourselves and not rely on the driver to do it?

Or, how do other ethernet drivers handle this? I think most of them call detach() inside attach() to tear down the internal state? Is iflib doing that?

Note: See TracTickets for help on using tickets.