AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Cvek <petrcvekcz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: "Deucher,
	Alexander" <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org>,
	"David1.Zhou-5C7GfCeVMHo@public.gmane.org"
	<David1.Zhou-5C7GfCeVMHo@public.gmane.org>,
	"Koenig,
	Christian" <christian.koenig-5C7GfCeVMHo@public.gmane.org>,
	"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	"sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org"
	<sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org>
Subject: Re: [BUG, regression] Dereferencing of NULL pointer in radeon_mn_unregister()
Date: Sun, 1 Sep 2019 17:48:36 +0200	[thread overview]
Message-ID: <2fc7ef14-e89a-1f2d-381d-1c9b05da02d3@gmail.com> (raw)
In-Reply-To: <20190901140409.GA1251-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Dne 01. 09. 19 v 16:04 Jason Gunthorpe napsal(a):
> On Sun, Sep 01, 2019 at 11:38:10AM +0200, Petr Cvek wrote:
> 
>> The code is:
>>
>> 	struct radeon_mn *rmn = bo->mn;
>> 	...
>> 	mutex_lock(&rmn->lock);		//<-crash
>>
>> A quick assert proves the bo->mn returns NULL. The code worked in
>> 4.19-rc and it seems the problematic patch is
> 
> Hum, the code went away because the locking protecting that variable
> went away.. It means the caller is not careful to pair register and
> unregister.
>  
>> 	drm/radeon: use mmu_notifier_get/put for struct radeon_mn
>>
>> as it removes the NULL check.
>>
>> Forcing -ENODEV in the register funtion (and immediate return in
>> unregister as without CONFIG_MMU_NOTIFIER) works.
> 
> Is just adding a
> 
>   if (!rmn)
>        retrun
> 
> To the top of radeon_mn_unregister enough to fix it?

Yeah it seems to work. A further test with minetest works too.

Petr 

> 
> Jason
> 
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2019-09-01 15:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-01  9:38 [BUG, regression] Dereferencing of NULL pointer in radeon_mn_unregister() Petr Cvek
     [not found] ` <dad0e51a-0f06-e2b0-cef7-3587207c2045-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-09-01 14:04   ` Jason Gunthorpe
     [not found]     ` <20190901140409.GA1251-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2019-09-01 15:48       ` Petr Cvek [this message]
     [not found]         ` <2fc7ef14-e89a-1f2d-381d-1c9b05da02d3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-09-02  6:19           ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2fc7ef14-e89a-1f2d-381d-1c9b05da02d3@gmail.com \
    --to=petrcvekcz-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Alexander.Deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=David1.Zhou-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox