gpu: nvgpu: unregister reboot notifier for pci driver

Below oops is encountered as reboot notifier was not unregistered on
nvgpu unload. On registering new reboot notifier on reload of the
nvgpu module, kernel is not able to access prior freed notifier
buffer. Reboot notifier unregistration was not present in
nvgpu_pci_remove. Add it.

 Unable to handle kernel paging request at virtual address
 Internal error: Oops: 96000004 [#1] PREEMPT SMP^M
 CPU: 0 PID: 997 Comm: modprobe Tainted: G   W   5.10.152-tegra #2^M
 pstate: a2400009 (NzCv daif +PAN -UAO +TCO BTYPE=--)^M
 pc : blocking_notifier_chain_register+0x50/0xf0^M
 lr : blocking_notifier_chain_register+0x3c/0xf0^M
  blocking_notifier_chain_register+0x50/0xf0^M
  register_reboot_notifier+0x2c/0x40^M
  nvgpu_pci_shutdown+0xaac/0x1b00 [nvgpu]^M
  pci_device_probe+0xf8/0x1f0^M
  really_probe+0x104/0x510^M
  driver_probe_device+0x108/0x190^M
  device_driver_attach+0x80/0x90^M
  __driver_attach+0xfc/0x1e0^M
  bus_for_each_dev+0x84/0x100^M
  driver_attach+0x34/0x50^M
  bus_add_driver+0x15c/0x260^M
  driver_register+0x68/0x130^M
  __pci_register_driver+0x78/0x90^M
  nvgpu_pci_init+0x3c/0x74 [nvgpu]^M
  init_module+0x18/0xe9c [nvgpu]^M
  do_one_initcall+0x50/0x310^M
  do_init_module+0x50/0x200^M
  load_module+0x22dc/0x2800^M

Bug 3495440

Change-Id: I4367352c57d4858ee0b8dda7d1181c9d01632791
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2907442
Reviewed-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-by: Ramalingam C <ramalingamc@nvidia.com>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Sagar Kamble
2023-05-19 17:39:01 +05:30
committed by mobile promotions
parent 6f4b7d5cc2
commit 278f87e0ce

View File

@@ -860,6 +860,8 @@ static void nvgpu_pci_remove(struct pci_dev *pdev)
nvgpu_remove(dev);
unregister_reboot_notifier(&l->nvgpu_reboot_nb);
#if defined(CONFIG_PCI_MSI)
if (g->msi_enabled)
pci_disable_msi(pdev);