2024-01-23 02:19:37

by Steven Rostedt

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

On Mon, 22 Jan 2024 19:56:08 -0500
"Bhardwaj, Rajneesh" <[email protected]> wrote:

>
> On 1/22/2024 7:43 PM, Linus Torvalds wrote:
> > On Mon, 22 Jan 2024 at 15:17, Steven Rostedt<[email protected]> wrote:
> >> Perhaps this is the real fix?
> > If you send a signed-off version, I'll apply it asap.
>
>
> I think a fix might already be in flight. Please see Linux-Kernel
> Archive: Re: [PATCH] drm/ttm: fix ttm pool initialization for
> no-dma-device drivers (iu.edu)
> <https://lkml.iu.edu/hypermail/linux/kernel/2401.1/06778.html>

Please use lore links. They are much easier to follow and use.

https://lore.kernel.org/lkml/[email protected]/

is the patch I believe you are referencing.

The fix doesn't need to be mine, but this should be in Linus's tree ASAP.

-- Steve


2024-01-23 02:56:51

by Dave Airlie

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

On Tue, 23 Jan 2024 at 12:15, Steven Rostedt <[email protected]> wrote:
>
> On Mon, 22 Jan 2024 19:56:08 -0500
> "Bhardwaj, Rajneesh" <[email protected]> wrote:
>
> >
> > On 1/22/2024 7:43 PM, Linus Torvalds wrote:
> > > On Mon, 22 Jan 2024 at 15:17, Steven Rostedt<[email protected]> wrote:
> > >> Perhaps this is the real fix?
> > > If you send a signed-off version, I'll apply it asap.
> >
> >
> > I think a fix might already be in flight. Please see Linux-Kernel
> > Archive: Re: [PATCH] drm/ttm: fix ttm pool initialization for
> > no-dma-device drivers (iu.edu)
> > <https://lkml.iu.edu/hypermail/linux/kernel/2401.1/06778.html>
>
> Please use lore links. They are much easier to follow and use.

https://lore.kernel.org/dri-devel/[email protected]/T/#u

should also fix it, Linus please apply it directly if Steven has a
chance to give it a run.

Thanks,
Dave.

2024-01-23 02:57:49

by Dave Airlie

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

On Tue, 23 Jan 2024 at 12:21, Dave Airlie <[email protected]> wrote:
>
> On Tue, 23 Jan 2024 at 12:15, Steven Rostedt <[email protected]> wrote:
> >
> > On Mon, 22 Jan 2024 19:56:08 -0500
> > "Bhardwaj, Rajneesh" <[email protected]> wrote:
> >
> > >
> > > On 1/22/2024 7:43 PM, Linus Torvalds wrote:
> > > > On Mon, 22 Jan 2024 at 15:17, Steven Rostedt<[email protected]> wrote:
> > > >> Perhaps this is the real fix?
> > > > If you send a signed-off version, I'll apply it asap.
> > >
> > >
> > > I think a fix might already be in flight. Please see Linux-Kernel
> > > Archive: Re: [PATCH] drm/ttm: fix ttm pool initialization for
> > > no-dma-device drivers (iu.edu)
> > > <https://lkml.iu.edu/hypermail/linux/kernel/2401.1/06778.html>
> >
> > Please use lore links. They are much easier to follow and use.
>
> https://lore.kernel.org/dri-devel/[email protected]/T/#u
>
> should also fix it, Linus please apply it directly if Steven has a
> chance to give it a run.

I see Linus applied the other one, that's fine too.

Dave.

2024-01-23 03:00:56

by Steven Rostedt

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

On Tue, 23 Jan 2024 12:32:39 +1000
Dave Airlie <[email protected]> wrote:

> On Tue, 23 Jan 2024 at 12:21, Dave Airlie <[email protected]> wrote:
> >
> > On Tue, 23 Jan 2024 at 12:15, Steven Rostedt <[email protected]> wrote:
> > >
> > > On Mon, 22 Jan 2024 19:56:08 -0500
> > > "Bhardwaj, Rajneesh" <[email protected]> wrote:
> > >
> > > >
> > > > On 1/22/2024 7:43 PM, Linus Torvalds wrote:
> > > > > On Mon, 22 Jan 2024 at 15:17, Steven Rostedt<[email protected]> wrote:
> > > > >> Perhaps this is the real fix?
> > > > > If you send a signed-off version, I'll apply it asap.
> > > >
> > > >
> > > > I think a fix might already be in flight. Please see Linux-Kernel
> > > > Archive: Re: [PATCH] drm/ttm: fix ttm pool initialization for
> > > > no-dma-device drivers (iu.edu)
> > > > <https://lkml.iu.edu/hypermail/linux/kernel/2401.1/06778.html>
> > >
> > > Please use lore links. They are much easier to follow and use.
> >
> > https://lore.kernel.org/dri-devel/[email protected]/T/#u
> >
> > should also fix it, Linus please apply it directly if Steven has a
> > chance to give it a run.
>
> I see Linus applied the other one, that's fine too.
>

They don't look mutually exclusive. I can test the other one as well.

-- Steve

2024-01-23 09:43:56

by Christian König

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

Am 23.01.24 um 03:52 schrieb Steven Rostedt:
> On Tue, 23 Jan 2024 12:32:39 +1000
> Dave Airlie <[email protected]> wrote:
>
>> On Tue, 23 Jan 2024 at 12:21, Dave Airlie <[email protected]> wrote:
>>> On Tue, 23 Jan 2024 at 12:15, Steven Rostedt <[email protected]> wrote:
>>>> On Mon, 22 Jan 2024 19:56:08 -0500
>>>> "Bhardwaj, Rajneesh" <[email protected]> wrote:
>>>>
>>>>> On 1/22/2024 7:43 PM, Linus Torvalds wrote:
>>>>>> On Mon, 22 Jan 2024 at 15:17, Steven Rostedt<[email protected]> wrote:
>>>>>>> Perhaps this is the real fix?
>>>>>> If you send a signed-off version, I'll apply it asap.
>>>>>
>>>>> I think a fix might already be in flight. Please see Linux-Kernel
>>>>> Archive: Re: [PATCH] drm/ttm: fix ttm pool initialization for
>>>>> no-dma-device drivers (iu.edu)
>>>>> <https://lkml.iu.edu/hypermail/linux/kernel/2401.1/06778.html>
>>>> Please use lore links. They are much easier to follow and use.
>>> https://lore.kernel.org/dri-devel/[email protected]/T/#u
>>>
>>> should also fix it, Linus please apply it directly if Steven has a
>>> chance to give it a run.
>> I see Linus applied the other one, that's fine too.
>>
> They don't look mutually exclusive. I can test the other one as well.

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.

Regards,
Christian.

>
> -- Steve


2024-01-23 14:34:09

by Steven Rostedt

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

On Tue, 23 Jan 2024 10:43:04 +0100
Christian König <[email protected]> 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