Re: [BUG] BUG: kernel NULL pointer dereference at ttm_device_init+0xb4

From: Steven Rostedt
Date: Tue Jan 23 2024 - 09:34:10 EST


On Tue, 23 Jan 2024 10:43:04 +0100
Christian König <christian.koenig@xxxxxxx> wrote:

> While applying the fix a week ago I was under the impression that QXL
> doesn't use a device structure because it doesn't have one and so can't
> give anything meaningful for this parameter.
>
> If QXL does have a device structure and can provide it I would rather
> like to go down this route and make the device and with it the numa node
> mandatory for drivers to specify.

Then at a minimum my original fix should be applied. Perhaps with a warning
too. That is, I added at the beginning of that function:

if (!dev)
return -EINVAL;

Could have that be:

if (WARN_ON_ONCE(!dev))
return -EINVAL;

In any case, it should not cause the system to crash.

-- Steve