Re: [PATCH] fwctl: Fix class init ordering to avoid NULL pointer dereference on device removal

From: Jason Gunthorpe

Date: Fri Apr 10 2026 - 17:50:58 EST


On Fri, Apr 10, 2026 at 10:16:19AM -0700, Dave Jiang wrote:

> Yeah, I'm just not coming up with a good solution for the
> driver-core. I presume that the way it's setup to allow 'sp' to be
> NULL because there are scenarios where it is NULL? Not sure if just
> allowing the kernel to OOPs on uninitialized knode is fine because
> it's a programming error or if that should be handled more
> gracefully.

The real issue is the fwctl register failed even though the class
isn't registered. I didn't try to trace down the details but I do find
that a bit surprising the driver core didn't complain during
registration

Jason