Re: [BUG, regression] Dereferencing of NULL pointer in radeon_mn_unregister()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux